editing in multiple gridview in asp.net

Posted by Bhagwati under ASP.NET on 7/4/2012 | Points: 10 | Views : 1814 | Status : [Member] | Replies : 6
hi,
I create a page in asp in that i am creating a gridview by loop in c# code.
now i want to give edit/update delete operation into these grid view.
please give some idea.

Bhagwati pal


Responses

Posted by: Kamalakanta.Nayak09 on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
Follow this link :-
http://www.aspdotnet-suresh.com/2011/02/how-to-inserteditupdate-and-delete-data.html

Thanks,
K.K

Bhagwati, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhagwati on: 7/5/2012 [Member] Starter | Points: 25

Up
0
Down
it's in static gridview i am creating gridview by c# code like Gridview gv=new Gridview.

Bhagwati pal

Bhagwati, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 7/5/2012 [Member] Starter | Points: 25

Up
0
Down
1)For EDIT
<asp:TemplateField HeaderText="Column 1">
<EditItemTemplate>
<asp:TextBox ID="txtEditEnglish" runat="server" Text='<%# Eval("AD__Desc") %>'
Width="700px"></asp:TextBox>
</EditItemTemplate>

</asp:TemplateField>

Protected Sub gv_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gv.RowEditing
gv.EditIndex = e.NewEditIndex
fill_load()
End Sub

2)For DELETE
<asp:TemplateField HeaderText="Delete COlumn">
<itemtemplate>
<asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/Images/delete.jpg" CommandName="delete"
OnClientClick="return confirm('Are you sure u want to delete this entry');" />
</itemtemplate>

</asp:TemplateField>

IN gv_ROWDeleting,call query for deleting row

3)For UPDATE
In gv_RowUpdating,call update query

4)In gridview dont forget to call all functions

<asp:GridView ID="gv" OnRowUpdating="gv_RowUpdating" AllowSorting="True" runat="server" AutoGenerateColumns="False"
ShowFooter="True" OnSorting="gv_Sorting" OnRowDeleting="gv_RowDeleting">



Bhagwati, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhagwati on: 7/5/2012 [Member] Starter | Points: 25

Up
0
Down
i didn't create grid on aspx page i create by aspx.cs i.e C# code.

Bhagwati pal

Bhagwati, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muralidosscm on: 7/6/2012 [Member] Starter | Points: 25

Up
0
Down
http://blogs.msdn.com/b/mattdotson/archive/2005/11/09/real-world-gridview-bulk-editing.aspx

Regards
Muralidoss M

Bhagwati, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 7/10/2012 [Member] [MVP] Gold | Points: 25

Login to post response