asp.net - How to add a button control dynamically into a GridView cell ? VB.NET -


look, it´s simple. have gridview populated data database.

what want put button in each cell contains specific datum.

pls, image below. describes want

in vb.net, pls! =)

example image

thanks much!

you going need define button control inside of <columns> section of gridview markup, this:

<asp:gridview id="customersgridview" runat="server">     <columns>         <asp:boundfield datafield="datecolumn" headertext="date"/>         <asp:templatefield>             <headertemplate>                 positive             </headertemplate>             <itemtemplate>                 <asp:label id="labelpositive" runat="server" text='<%# eval("positivecolumn")%>' />                 <br />                 <asp:button id="buttonpositive" runat="server" text="show" />             </itemtemplate>         </asp:templatefield>         <asp:templatefield>             <headertemplate>                 negative             </headertemplate>             <itemtemplate>                 <asp:label id="labelnegative" runat="server" text='<%# eval("negativecolumn")%>' />                 <br />                 <asp:button id="buttonnegative" runat="server" text="show" />             </itemtemplate>         </asp:templatefield>         <asp:templatefield>             <headertemplate>                 neutral             </headertemplate>             <itemtemplate>                 <asp:label id="labelneutral" runat="server" text='<%# eval("neutralcolumn")%>' />                 <br />                 <asp:button id="buttonneutral" runat="server" text="show" />             </itemtemplate>         </asp:templatefield>         <asp:boundfield datafield="nocommentscolumn" headertext="no comments"/>         <asp:boundfield datafield="totalcolumn" headertext="total"/>     </columns> </asp:gridview> 

note: datafield , eval() calls bound made names neutralcolumn , nocommentscolumn, substitute names real database field names.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -