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"/>
- set
autogeneratecolumns="false"
in gridview markup - define columns
boundfield
(ortemplatefield
if wish) - add a
templatefield
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
Post a Comment