Reputation: 11
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?
Upvotes: 1
Views: 129
Reputation: 8360
Use a LinkButton server side control:
<asp:LinkButton ID="Taggloud" runat="server" onclick="TagOnCloud_Click">click</asp:LinkButton>
Upvotes: 0
Reputation: 25662
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.
Upvotes: 2
Reputation: 7539
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.
Upvotes: 1