c# - Update dynamically column header within Repeater -
i want update text of column header based on type of object. let's have objecta , objectb; if objecta want appear in second column "a version". if not objecta (meaning objectb) update same column " b version" text.
i have in .aspx file:
<asp:repeater runat="server" id="rptbillheaders" onitemdatabound="rptbillheaders_itemdatabound"> <headertemplate> <table width="98%" align="center" class="grid" cellpadding="0" cellspacing="0" style="border:solid 1px #000000; border-top:none 0px #ffffff;"> <tr class="gridheaderrow"> <th> </th> <th><asp:label runat="server" id="billversionlabel" ></asp:label></th> <th>action type</th> <th>doc # </th> <th>status</th> <th>total amount</th> <th>developed by</th> <th>date submitted</th> <th>date processed</th> ...
in code-behind have:
protected void rptbillheaders_itemdatabound(object sender, repeateritemeventargs e) { repeateritem item = e.item; if (item.itemtype == listitemtype.item || item.itemtype == listitemtype.alternatingitem) { repeater rptlineitems = ((repeater)item.findcontrol("rptlineitems")); rptlineitems.datasource = currentbill.lineitemsbyobjversion[rownumber].sort(billlineitem.sortcolumn.lineitemnumber, system.data.sqlclient.sortorder.ascending); rptlineitems.databind(); rownumber++; } control headertemplate = rptbillheaders.controls[0].controls[0]; label billversionlabel = headertemplate.findcontrol("billversionlabel") label; if (lit.billtypes.obja == "a") { billversionlabel.text = " version"; } else if (lit.billtypes.objb == "b") { billversionlabel.text = " b version"; } }
it might easy do, i'm learning asp.net. therefore, researched on how developed , has tutorial 1 tried implement in solution.
so far no changes appears in when run web application.
thanks in advance.
nm
Comments
Post a Comment