Tutorial :accessing serverside code from client program


How can I access server side functions from the HTML code? See the following code:

<a id="Taggloud" runat="server" class="lblTagCloud" onClick="TagOnCloud_Click">click</a>  

Here I'm calling the tagonCloud_click function that's defined in server side(code behind). How can i call that function?


If you don't mind a full post back, swap out the <a> tag for a <asp:HyperLink>, which will allow you to wire up server-side event handlers.


You will need to make a web service and call that web service from the client (via jQuery is one option).

That web service can call a function. However, I'd put the code you have in the tagonCloud_click function in another function and have the click call that function. That way both the web service and click function can call it.


Use a LinkButton server side control:

<asp:LinkButton ID="Taggloud" runat="server" onclick="TagOnCloud_Click">click</asp:LinkButton>  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »