jquery - How to execute specific JavaScript to enable specific panel after postback -


i find out there way execute specific javascript trigger visibility of specific block after post back?

this link button suppose job

<asp:linkbutton id="lbtview" runat="server" cssclass="btn btn-xs btn-default" commandargument='<%# eval("orderid.orderid") %>' commandname='<%# "details" %>'><i class="fa fa-eye"></i></asp:linkbutton>     <%--order datails--%> 

this script want execute after postback, toggle visibility of specific block

response.write("$('').hide(); $('#orderdetails').show()"); 

section of current code

   <asp:listview id="listview1" runat="server" onitemcommand="listview1_itemcommand">                                <itemtemplate>                                    <tr>                                        <td><asp:label id="lblorderno" runat="server" text='<%# eval("orderid.orderid") %>'></asp:label></td>                                        <td><asp:label id="lbldate" runat="server" text='<%# string.format("{0:dd/mm/yyyy}", eval("dateofpayment") ) %>'></asp:label></td>                                        <td><asp:label id="lblamount" runat="server" text='<%# string.format("{0:c}", eval("finalamount")) %>'></asp:label></td>                                        <td class="text-center">                                            <div class="btn-group">                                             <asp:linkbutton id="lbtview" runat="server" cssclass="btn btn-xs btn-default" commandargument='<%# eval("orderid.orderid") %>' commandname='<%# "details" %>'><i class="fa fa-eye"></i></asp:linkbutton>     <%--order datails--%>                                           <%--  <asp:button id="lbtview" runat="server" text="button" cssclass="btn btn-xs btn-default" commandargument='<%# eval("orderid.orderid") %>' commandname='<%# "details" %>' href="#"></asp:button>--%>                                            <asp:linkbutton id="lbtinvoice" runat="server" cssclass="btn btn-xs btn-default" commandargument='<%# eval("orderid.orderid") %>' commandname='<%# "invoice" %>'><i class="fa fa-file-text"></i></asp:linkbutton>        <%--order invoice   --%>                                                                                             </div>                                        </td>                                    </tr>                                 </itemtemplate>                            </asp:listview> 

section of relevant class

protected void listview1_itemcommand(object sender, listviewcommandeventargs e) {     if (e.commandname == "details")     {         response.write("$('').hide(); $('#orderdetails').show()");         oid = e.commandargument.tostring();           //bind order items         lblorderno.text = e.commandargument.tostring();         payment p = paymentdb.getpaymentfromod(e.commandargument.tostring());         list<orderitem> oilist = orderdetailsdb.getorderitems(e.commandargument.tostring());         lblorderdate.text = p.dateofpayment.toshortdatestring();         lbltodtal.text = p.finalamount.tostring("c");          //---------------------------------order items bind           //----------------------------------------------------------------status update-----------         bindstatus(oilist);      }     else if (e.commandname == "invoice")     {         session["orderid"] = e.commandargument.tostring();         server.transfer("order-invoice.aspx");     } } 

since default #orderdetails hidden, whenever page re-load turn hidden again, in other words have try toggle visibility of block after page load. or have other suggestion on how this?

you can set script tag clientscript.registerclientscriptblock if want so:

clientscript.registerclientscriptblock(this.gettype(), "myscript", "alert('hello');", true) 

but might recommend using placeholder (or panel) control visibility of content in server side:

<asp:placeholder id="orderdetailsplaceholder" runat="server" visible="false">     <div id="orderdetails">         content     </div> </asp:placeholder> 

and in event on code behind:

orderdetailsplaceholder.visible = true 

hope helps!


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -