c# - BulletedList in Reapeter -


i have 2 tables in database w/c connected

tblpackage id name 1  package 2  package b  tbldetails id packageid details 1  1         packagedetails11 2  1         packagedetails12 3  1         packagedetails13 4  1         packagedetails14 5  2         packagedetails21 6  2         packagedetails22 7  2         packagedetails23 

now want manipulate on repeater

html

<asp:repeater id="rptrpackage" runat="server"> <itemtemplate>     <asp:label id="pack" runat="server" text='<%# bind("pack") %>'></asp:label>     <asp:bulletedlist id="details" runat="server">     </asp:bulletedlist>     </itemtemplate> </asp:repeater> 

asp

private void populate() {     datatable dtpackage = tblpackage();     datatable dtdetails = tbldetails();      rptrpackage.datasource = dtpackage;     rptrpackage.databind(); } 

try this

aspx

    <asp:repeater id="rptrpackage" runat="server">         <itemtemplate>             <asp:label id="pack" runat="server" text='<%# bind("pack") %>'></asp:label>             <asp:hiddenfield id="hid" value='<%# eval("packageid") %>' runat="server" />             <asp:repeater runat="server" id="rptdetails">                 <headertemplate>                     <ul>                 </headertemplate>                 <itemtemplate>                     <li>                         <%# eval("details")%>                     </li>                 </itemtemplate>                 <footertemplate>                     </ul>                 </footertemplate>             </asp:repeater>         </itemtemplate>     </asp:repeater> 

code behind

    private void populate()     {         datatable dtpackage = tblpackage();         datatable dtdetails = tbldetails();          rptrpackage.datasource = dtpackage;         rptrpackage.databind();          foreach (repeateritem item in rptrpackage.items)         {             repeater rptdetails = ((repeater)item.findcontrol("rptdetails"));             rptdetails.datasource = dtdetails.select("packageid = " + ((hiddenfield)item.findcontrol("hid")).value).copytodatatable();             rptdetails.databind();         }     } 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -