c# - Adding a button to the last column of a GridView -


this how created grid view in asp.net c# project. grid has 4 columns. want add 5th column , add button on each , every row. how can ?

<asp:gridview id="gv" runat="server"  cellpadding="1" width="900px"/> 

  1. set autogeneratecolumns="false" in gridview markup
  2. define columns boundfield (or templatefield if wish)
  3. add atemplatefield button in last column

sum up:

<asp:gridview runat="server" id="gv" autogeneratecolumns="false" cellpadding="1" width="900px">     <columns>         <%-- <asp:boundfield /> definitions here --%>         ...         <asp:templatefield>             <itemtemplate>                 <asp:button text="click me" runat="server" id="btn" onclick="clicked" />                     </itemtemplate>         </asp:templatefield>     </columns> </asp:gridview> 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -