When you create the code of Gridview place the code like this for your customized Controls(Button)
<asp:imagebutton id="imgProfile" width="100px" height="100px" runat="server" imageurl="'<%#">' CommandName="cmdImage" CommandArgument='<%# Container.DataItemIndex %>' />
Here look at the COmmand argument property it should be like this. Then only we can take the Index of the Gridview.
Now, in Code behind you can call it like this....
string name = ((TextBox)GridView1.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("TextBoxName")).Text;
thus you can work on it getting the index of the row.
No comments:
Post a Comment