c# - Show content with button click without postback -
<asp:updatepanel id="uptaskinfo" runat="server" clientidmode="static" updatemode="conditional"> <contenttemplate> <div class="customalertdisplay hidetag" id="customalertdisplay" runat="server"> <section class="notif notif-warn"> <h6 class="notif-title">warning!</h6> <p>this task forced checked out user. changes not saved site.master.</p> <div class="notif-controls"> <a href="javascript:void(0);" class="notif-close" id="cbtn" title="close message">close</a> </div> </section> </div> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="lb1" /> </triggers> </asp:updatepanel> <asp:updatepanel id="up1" runat="server" clientidmode="static" updatemode="conditional"> <contenttemplate> <asp:linkbutton id="lb1" onclick="lbsave1_click" runat="server">show</asp:linkbutton> </contenttemplate> </asp:updatepanel>
css:
.hidetag { display: none; }
code-behind:
public void lbsave1_click(object sender, eventargs e) { customalertdisplay.attributes.remove("hidetag"); uptaskinfo.update(); }
i trying show customalertdisplay
div when click lb1
linkbutton without doing postback not working.
how can update code, when button clicked div shown without postback.
you can't use c# events without postback, they're fired @ server. use jquery add/remove/toggle css class instead.
Comments
Post a Comment