【问题标题】:How to get gridview cell value when i click on cell dynamically in ASP.Net当我在 ASP.Net 中动态单击单元格时如何获取 gridview 单元格值
【发布时间】:2011-09-08 01:58:49
【问题描述】:
我正在开发一个电影院座位预订网站,。我使用ImageButton 将图像作为Seats 放置在asp:gridview(all cells) 中。对于选定的座位,当用户点击它时,会为该座位设置ImageButton(cell)。
我需要从gridview 获得点击的席位。我怎么能做到这一点?
【问题讨论】:
标签:
asp.net
gridview
selection
【解决方案1】:
您可以在网格视图的 RowCommand 事件中找到 ImageButton。
代码部分:
string strType="";
ImageButton img = (ImageButton)e.CommandSource;
strType = img.Attributes["TypeID"].ToString();
设计师部分:
<asp:ImageButton ID="imgBtn" runat="server" ImageUrl="image"
TypeID="..Give your value.." />