How to get gridview cell value when i click on cell dynamically in ASP.Net
I am developing a movie theater seats booking website,. I have placed images as Seats
in asp:gridview(all cells)
using ImageButton
. For the selected seat, when the user clicks on it, the ImageButton(cell)
is set for that s开发者_开发百科eat.
I need to get the seat that was clicked from the gridview
. How am I able to do this?
You can find the ImageButton on the RowCommand event of the grid view.
Code part:
string strType="";
ImageButton img = (ImageButton)e.CommandSource;
strType = img.Attributes["TypeID"].ToString();
Designer part:
<asp:ImageButton ID="imgBtn" runat="server" ImageUrl="image"
TypeID="..Give your value.." />
精彩评论