Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a gridview with two databound fields and two command fields(for edit and delete).
I can,t edit or delete any row.
Please send any code.
Posted
Updated 21-Sep-11 21:44pm
v4
Comments
P.Salini 22-Sep-11 2:58am    
You can google it

This is an example code...Just go through it...Are you looking for something like this?
XML
<asp:TemplateField HeaderText ="Edit" >

           <ItemTemplate >
           <asp:LinkButton ID ="lnk1" runat ="server" Text ="Edit" CommandName ="edit">
           </asp:LinkButton>

           </ItemTemplate>
           <EditItemTemplate>
 
Share this answer
 
Comments
lll1234 22-Sep-11 3:40am    
I did coding like this

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BackColor="White" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" PageSize="5" OnDataBound="GridView1_DataBound" OnRowDataBound="GridView1_RowDataBound" OnRowEditing="GridView1_RowEditing1" OnRowUpdating="GridView1_RowUpdating1" OnSelectedIndexChanged="GridView1_SelectedIndexChanged1" >
<footerstyle backcolor="#5D7B9D" font-bold="True" forecolor="White">
<columns>
<asp:TemplateField HeaderText="Equipment No">
<edititemtemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("eqno") %>'>

<itemtemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("eqno") %>'>


<asp:TemplateField HeaderText="Workmen" SortExpression="workmen">
<edititemtemplate>
<asp:TextBox ID="txtworkmen" runat="server" Text='<%# Bind("workmen") %>'>

<itemtemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("workmen") %>'>


<asp:CommandField ShowDeleteButton="True" />
<asp:CommandField ShowEditButton="True" />

<rowstyle backcolor="#F7F6F3" forecolor="#333333">
<editrowstyle backcolor="#999999">
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<alternatingrowstyle backcolor="White" forecolor="#284775">
Start with Editable GridView in ASP.NET 2.0[^]. No one will send you any direct code. Search on the internet for more articles.
 
Share this answer
 
v2
Comments
lll1234 22-Sep-11 3:36am    
I did the coding but the value cant be retrieved, only the coumn name is getting.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900