asp.net - VB ItemTemplate DataBinder.Eval Container.DataItem in C# -
this html in vb project being ported new c# app:
<asp:datagrid id="dg1" runat="server" horizontalalign="center" autogeneratecolumns="false" width="850" allowsorting="true" onsortcommand="lawsortevent" showfooter="true" onitemdatabound="lawdg_itemdatabound" footerstyle-font-bold="true" > <columns> <asp:boundcolumn datafield="id" headertext="" headerstyle-horizontalalign="center" itemstyle-horizontalalign="center" /> <asp:boundcolumn datafield="afecategory" sortexpression="afecategory" headertext="code" headerstyle-horizontalalign="center" itemstyle-horizontalalign="right" /> <asp:boundcolumn datafield="transdate" dataformatstring="{0:mm/dd/yyyy}" sortexpression="transdate" headertext="date" headerstyle-horizontalalign="center" itemstyle-horizontalalign="center" /> <asp:boundcolumn datafield="company" sortexpression="company" headertext="vendor" headerstyle-horizontalalign="center" itemstyle-horizontalalign="center" /> <asp:boundcolumn datafield="description" sortexpression="description" headertext="desc" headerstyle-horizontalalign="center" itemstyle-horizontalalign="left" /> <asp:boundcolumn datafield="systemtype" sortexpression="systemtype" headertext="system" headerstyle-horizontalalign="center" itemstyle-horizontalalign="center" /> <asp:boundcolumn datafield="apinvoice" sortexpression="apinvoice" headertext="ap inv" headerstyle-horizontalalign="center" itemstyle-horizontalalign="right" /> <asp:boundcolumn datafield="amount" sortexpression="amount" dataformatstring="{0:c}" headertext="total" headerstyle-horizontalalign="center" itemstyle-horizontalalign="right" /> <asp:templatecolumn headertext="" itemstyle-horizontalalign="center" > <itemtemplate> <asp:imagebutton id="btnviewinvoice" runat="server" imageurl="/images/glass2.png" oncommand="dgviewinvoice" commandargument='<%# databinder.eval(container.dataitem, "apinvoice") %>' commandname='<%# databinder.eval(container.dataitem, "vendornum") %>' alternatetext="view invoice" visible='<%# (databinder.eval(container.dataitem, "systemtype") <> "gl") %>' /> </itemtemplate> </asp:templatecolumn> </columns> </asp:datagrid> my issue imagebutton - don't know how write in c#, because i'm not sure trying do.
the closest found explaining of what's deal databinder.eval , container.dataitem?, i've been trying different ways of changing text make work last 30 minutes no success.
everytime change text, error message changes tried differently.
i rock.
i figured out.
skadoosh!
<asp:templatecolumn headertext="" itemstyle-horizontalalign="center" > <itemtemplate> <asp:imagebutton id="btnviewinvoice" runat="server" imageurl="/images/glass2.png" oncommand="dgviewinvoice" commandargument='<%# eval("apinvoice") %>' commandname='<%# eval("vendornum") %>' alternatetext="view invoice" visible='<%# eval("systemtype") != "gl") %>' /> </itemtemplate> </asp:templatecolumn>
Comments
Post a Comment