GridView & ImageButton
-
Hello, I put an ImageButton field on my GridView.I want this: when I clicked on the ImageButton, value of that row's ID field must returned that is selected with ImageButton . (I know my english is awful :) ) ImageButton code: <ItemTemplate> <asp:ImageButton runat="server" id="IMG1" ImageUrl='My URL' /> </ItemTemplate> Thnaks in advance
-
Hello, I put an ImageButton field on my GridView.I want this: when I clicked on the ImageButton, value of that row's ID field must returned that is selected with ImageButton . (I know my english is awful :) ) ImageButton code: <ItemTemplate> <asp:ImageButton runat="server" id="IMG1" ImageUrl='My URL' /> </ItemTemplate> Thnaks in advance
Try to trap Index from
RowCommand
event of GridViewAbhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article
-
Try to trap Index from
RowCommand
event of GridViewAbhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article
-
Hello, I put an ImageButton field on my GridView.I want this: when I clicked on the ImageButton, value of that row's ID field must returned that is selected with ImageButton . (I know my english is awful :) ) ImageButton code: <ItemTemplate> <asp:ImageButton runat="server" id="IMG1" ImageUrl='My URL' /> </ItemTemplate> Thnaks in advance
You can code like this inside Row_Command event int row_index = int.parse(e.CommandArgument.ToString()) Now row_index will have row index (which row's button u have clicked) Now u can access any value string abc = grd1.rows[row_index].cells[2].text.tostring()
By: Hemant Thaker
-
comp_j wrote:
What do I write in RowCommand event ?
Read this MSDN Article : It will help you for future too[^] ;)
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article
-
Hello, I put an ImageButton field on my GridView.I want this: when I clicked on the ImageButton, value of that row's ID field must returned that is selected with ImageButton . (I know my english is awful :) ) ImageButton code: <ItemTemplate> <asp:ImageButton runat="server" id="IMG1" ImageUrl='My URL' /> </ItemTemplate> Thnaks in advance
CommandArgument=<%#Container.DisplayIndex + 1 %> give this in image button and get the index by using this int.Parse(e.CommandArgument.ToString())