Answered by:
How to edit row in gridview using modal popup extender.

Question
-
User1197799509 posted
Hi all,
I've to edit rows in grid view for editing and I am using ImageButton for edit .
Situation is that whenever I will click on the edit image, modal popup extender will get open of that particular row which I want to edit and then I can edit it and update. I am using entity framework for my data source.
Please help me with the code as I am new in asp.net.
Thanks
Kusum
Thursday, May 26, 2016 8:01 AM
Answers
-
User61956409 posted
Hi Kusum,
I am unable to find Row index of Gridview after clicked on image button.You could try to use the following code to get the row index.
int rowindex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
Best Regards,
Fei Han
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, May 27, 2016 3:17 AM
All replies
-
Thursday, May 26, 2016 8:11 AM
-
Thursday, May 26, 2016 8:13 AM
-
User1197799509 posted
I follow the links but I am unable to find Row index of Gridview after clicked on image button.
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "edituser") { ImageButton imgdetails = (ImageButton)FindControl("edituser");//Problem is here null value found int EmpId = Convert.ToInt32(imgdetails); //some code } }
Code for image button
<asp:TemplateField> <ItemTemplate> <asp:ImageButton ID="edit" runat="server" CommandArgument='<%# Bind("EmpID") %>' CommandName="edituser" ImageUrl="image/images.jpg"
ToolTip="Edit User Details"> </asp:ImageButton> </ItemTemplate> </asp:TemplateField>Thursday, May 26, 2016 9:23 AM -
User61956409 posted
Hi Kusum,
I am unable to find Row index of Gridview after clicked on image button.You could try to use the following code to get the row index.
int rowindex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
Best Regards,
Fei Han
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, May 27, 2016 3:17 AM