asp.net - Open gridview inside template field of gridview -


i have image button in template field of gridview. want open gridview below row of plus button clicked problem inner gridview opens column of parent grid view , not opening below selected row. tried various design methods still not working. using jquery open child gridview on image button click. below design of grid , code jquery.

<div class="gridcontentholder">     <asp:gridview id="grdsamplestock" runat="server" alternatingrowstyle-cssclass="alt"                 autogeneratecolumns="false" cssclass="stylegrid" gridlines="none" onselectedindexchanged="grdsamplestock_selectedindexchanged"                 onrowdatabound="grdsamplestock_rowdatabound" onrowcreated="grdsamplestock_rowcreated">           <alternatingrowstyle cssclass="alt" />           <columns>                <asp:templatefield>                    <itemtemplate>                      <asp:hiddenfield id="hdnsamplestockmasterid" runat="server" value='<%#eval("samplestockmasterid") %>' />                         </itemtemplate>                     </asp:templatefield>                     <asp:boundfield headertext="doctorname" datafield="doctorname" />                     <asp:boundfield headertext="comments" datafield="comments" />                     <asp:boundfield headertext="totalsamplestockquantity" datafield="totalsamplestockquantity" />                     <asp:boundfield headertext="sampledate" datafield="sampledate" sortexpression="sampledate"                         dataformatstring="{0:dd/mm/yyyy}" htmlencode="false" nulldisplaytext="n/a" />                     <asp:templatefield>                        <itemtemplate>                             <a href="javascript:expandcollapse('div<%# eval("samplestockmasterid") %>', 'one');">                                 <img id="imgdiv<%# eval("samplestockmasterid") %>" alt="click show/hide orders customer <%# eval("samplestockmasterid") %>"                                     width="9px" border="0" src="../images/plus.gif" />                             </a>                         </itemtemplate>                     </asp:templatefield>                     <asp:templatefield>                         <itemtemplate>                             <%--<asp:panel id="pnlinnergrid" runat="server" >--%>                             <tr style="display: none;" id="div<%# eval("samplestockmasterid") %>">                                 <td colspan="5">                                      <asp:gridview id="grditems" cssclass="stylegrid" pagerstyle-cssclass="pgr" runat="server"                                         autogeneratecolumns="false" gridlines="none" onrowcreated="grditems_rowcreated"                                         alternatingrowstyle-cssclass="alt" >                                         <alternatingrowstyle cssclass="alt"></alternatingrowstyle>                                         <columns>                                             <asp:boundfield headertext="reference no" datafield="referenceno" />                                             <asp:boundfield datafield="productname" headertext="product" sortexpression="productname" />                                             <asp:boundfield datafield="specification" headertext="specification" sortexpression="specification" />                                             <%--  <asp:boundfield datafield="storekeeparid" headertext="storekeeparid" sortexpression="storekeeparid" />--%>                                             <%--<asp:boundfield datafield="name" headertext="storekeeper name" sortexpression="name" />--%>                                             <asp:boundfield datafield="warehousename" headertext="warehouse" sortexpression="warehousenmae" />                                             <asp:boundfield headertext="expiry date" datafield="expirydate" dataformatstring="{0:d}"                                                 htmlencode="false" />                                             <asp:boundfield headertext="lot no" datafield="lotno" />                                             <asp:templatefield>                                                 <itemtemplate>                                                     <asp:hiddenfield id="samplestocktrsid" runat="server" value='<%# eval("samplestocktrsid") %>' />                                                 </itemtemplate>                                             </asp:templatefield>                                         </columns>                                     </asp:gridview>                                  </td>                             </tr>                             <%--   </asp:panel>--%>                         </itemtemplate>                     </asp:templatefield>                 </columns>             </asp:gridview>    </div> 

//code jquery.

<script language="javascript" type="text/javascript">     $(document).ready(function () {         //            var=$('div[id^="player_"]')      });     function expandcollapse(obj, row) {         var div = document.getelementbyid(obj);         var img = document.getelementbyid('img' + obj);         if (div.style.display == "none") {             div.style.display = "";             $(div).hide().show(1000);             if (row == 'alt') {                 img.src = "../images/minus.gif";             }             else {                 img.src = "../images/minus.gif";             }             img.alt = "close view other sample transaction";         }         else {             $(div).hide(1000, function () {                 div.style.display = "none";             });             if (row == 'alt') {                 img.src = "../images/plus.gif";             }             else {                 img.src = "../images/plus.gif";             }             img.alt = "expand show available stock";         }     }  </script> 

i had used in 1 of previous projects. giving exect code sample project. modify according need. feel free ask questions.

<asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" onrowdatabound="gridview1_rowdatabound">     <columns>          <asp:templatefield>             <itemstyle backcolor="#c2d88b" width="250px" />             <itemtemplate>                 <div>                     //draw table here placing html table                 </div>                 <div>                     <p>                         <asp:listview id="listview1" runat="server">                             <itemtemplate>                                 <asp:label id="label1" runat="server" text='<%# eval("item_id") %>'></asp:label>                                 <asp:label id="label2" runat="server" text='<%# eval("quantity") %>'></asp:label>                             </itemtemplate>                             <itemseparatortemplate>                             <br />                                                                     </itemseparatortemplate>                         </asp:listview>                     </p>                 </div>             </itemtemplate>         </asp:templatefield>                      </columns> </asp:gridview> 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -