如何识别网格内的3个不同按钮,点击按钮时,应重定向到相应的页面 [英] How to identify 3 different buttons inside the grid and while click on button, it should redirect to respective pages
问题描述
我创建了一个网格视图。在网格视图中,我有3行,第一列有不同的3个按钮。我的疑问是,当我点击任何按钮时,它应该重定向到一个页面。
如何识别我在网格内点击的按钮。
EX - 网格内有3个不同的按钮。如何识别我点击的按钮。
类别 总计
合同0
EPT 0
QAC 0
Hi,
I have created one grid view. inside grid view, i have 3 rows with different 3 buttons in first column. My doubt is, when i click on any button, it should redirect to one page.
How to identify which button i clicked inside the grid .
EX--These 3 different buttons are there inside the grid. how to identify which button i clicked.
Category Total
Contract 0
EPT 0
QAC 0
<asp:TemplateField HeaderStyle-Width="180px">
<HeaderStyle />
<HeaderTemplate>
<center>
category</center>
</HeaderTemplate>
<ItemTemplate>
<asp:Button ID="btncategory" runat="server" CssClass="Button" Text='<%# Eval("Category")%>' Style="width: 180px;" />
</ItemTemplate>
</asp:TemplateField>
public DataTable AddTable(DataTable _dtblanck, string LoginName)
{
int constant = 0;
DataRow _drNewRow = _dtblanck.NewRow();
for (int _cnt = 1; _cnt < 4; _cnt++)
{
_drNewRow = _dtblanck.NewRow();
if (_cnt == 1)
_drNewRow["Category"] = "Contractor";
else if (_cnt == 2)
_drNewRow["Category"] = "EPT";
else if (_cnt == 3)
_drNewRow["Category"] = " QAC";
_dtblanck.Rows.Add(_drNewRow);
}
return _dtblanck;
推荐答案
如果您使用项目模板,如果您使用默认按钮列,则可以使用按钮名称识别使用命令名属性,你可以在rowcommandevent中捕获事件
u can identify using the button name if u use item template but if u use the default button column then u have the command name property using that u can capture the event in rowcommandevent
这篇关于如何识别网格内的3个不同按钮,点击按钮时,应重定向到相应的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!