[ACCEPTED]-execute serverside code on div click-vb.net
You need to raise a server event, not client 9 event (and it looks like you want to do 8 that asynchronously).
This article explains how to attach 7 a snippet of code to a client element (like 6 a
DIV) and cause an asynchronous postback.
Another 5 quick and dirty way of accomplishing this 4 is to use a hidden server button. The button 3 can be located wherever desired (such as 2 inside an
UpdatePanel) and it allows proper usage of 1 the ASP page lifecycle.
<asp:Button runat="server" id="btnPostback" style="display:none" onclick="serverEventHandler" /> <div onclick="document.getElementById('<%= btnPostback.ClientID %>').click()">Clickable DIV</div>
Check out this post raise postback event from div tag
Yours would look something 2 like
<div id="c" onclick="__doPostBack('loadContentFamily','')"> Family </div>
Try something like
<Triggers> <asp:AsyncPostBackTrigger ControlID="c" EventName="Click" /> </Triggers>
wrap your div inside a LinkButton control 3 and call your loadContentFamily method on 2 OnClick event of LinkButton. This worked 1 for me
I would recommend not using the UpdatePanel 2 control, but jQuery. You can find an example 1 here
More Related questions