How to edit in GridView
-
Hi everyone,i'm using GridView for display some details,so i need to allow user's to edit the data GridView it self,so how can i do that using RowCommand Event or is there any easy way to that?,i'm using StoredProcedure for that editing also. thank you.
-
Hi everyone,i'm using GridView for display some details,so i need to allow user's to edit the data GridView it self,so how can i do that using RowCommand Event or is there any easy way to that?,i'm using StoredProcedure for that editing also. thank you.
Put the different controls in GridView and in Row command event you will the row index and you can update query for the same.
-
Put the different controls in GridView and in Row command event you will the row index and you can update query for the same.
I didnt get u freind, can u some explain coding for me Thanks
-
I didnt get u freind, can u some explain coding for me Thanks
I have used checkbox u can use any control in the same way. Try the following: On Row Command: Protected Sub GridViewForm_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridViewForm.RowCommand Dim gvRow As GridViewRow For Each gvRow In GridViewForm.Rows If gvRow.RowType = ListItemType.Item Or gvRow.RowType = ListItemType.AlternatingItem Then If CType(GridViewForm.FindControl("chkAdd"), CheckBox).Checked Then CType(GridViewForm.FindControl("chkView"), CheckBox).Checked = True Else CType(GridViewForm.FindControl("chkView"), CheckBox).Checked = True End If End If Next End Sub Hope this helps u,if not then do reply...
-
Hi everyone,i'm using GridView for display some details,so i need to allow user's to edit the data GridView it self,so how can i do that using RowCommand Event or is there any easy way to that?,i'm using StoredProcedure for that editing also. thank you.
GridView in SmartTag have option allow editing, you should add column CommandField Edit,Update,Cancel Also you should specify in SqlDataSource in Update stored procedure. After that in the grid will appear column with link button Edit. Click it and data in columns with ReadOnly=false will be displayed in textbox.
-
I have used checkbox u can use any control in the same way. Try the following: On Row Command: Protected Sub GridViewForm_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridViewForm.RowCommand Dim gvRow As GridViewRow For Each gvRow In GridViewForm.Rows If gvRow.RowType = ListItemType.Item Or gvRow.RowType = ListItemType.AlternatingItem Then If CType(GridViewForm.FindControl("chkAdd"), CheckBox).Checked Then CType(GridViewForm.FindControl("chkView"), CheckBox).Checked = True Else CType(GridViewForm.FindControl("chkView"), CheckBox).Checked = True End If End If Next End Sub Hope this helps u,if not then do reply...
Thnks freind,i have set the edit thing in gridview in different way,that is i use EditItemIndex into -1 and i check it and i put my primary key into DataKeyField,i need according my ID update the data into database,how can i do that.
-
Thnks freind,i have set the edit thing in gridview in different way,that is i use EditItemIndex into -1 and i check it and i put my primary key into DataKeyField,i need according my ID update the data into database,how can i do that.
U can write the update query on Row Command event of GridView.