我在GridView中使用Link按钮作为模板字段。
现在我想显示所点击的Linkbutton的行索引。
请建议我一个解决方案预先感谢GridView中LinkButton的行索引
5
A
回答
5
请试试这个:
protected void userGridview_RowCommand(object sender, GridViewCommandEventArgs e)
{
GridViewRow rowSelect = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
int rowindex = rowSelect.RowIndex;
}
12
想在项模板这是乌拉圭回合的代码链接按钮
<ItemTemplate>
<asp:LinkButton ID="lnkapprove" Font-Underline="true" runat="server" Text="Approve" OnClick="lnkapprove_Click"></asp:LinkButton>
</ItemTemplate>
背后:
protected void lnkapprove_Click(object sender, EventArgs e)
{
LinkButton btn = (LinkButton)sender;
GridViewRow row = (GridViewRow)btn.NamingContainer;
int i = Convert.ToInt32(row.RowIndex);
}
你可以得到row.RowIndex像这..
希望这有助于..
1
您也可以尝试这样
protected void userGridview_RowBound(object sender, GridViewCommandEventArgs e)
{
GridViewRow rowSelect = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
int rowindex = rowSelect.RowIndex;
}
相关问题
- 1. Gridview和LinkButton
- 2. 隐藏的LinkButton在asp.net GridView控件
- 3. 从GridView LinkButton弹出的XML点击
- 4. WebForms GridView行的LinkButton回调没有触发
- 5. GridView行上的服务器标签格式不正确LinkButton
- 6. ASP.NET MVC中的LinkButton
- 7. 如何使用ASP.Net C#中的ModalPopupExtender在GridView中连接LinkButton?
- 8. ASP.NET GridView控件 - 关于LinkButton的列中的某些问题
- 9. 的LinkButton在GridView中不是第2次
- 10. 如何在RowCommand事件中获取GridView的LinkButton ForeColor?
- 11. 在Rowcommand触发之前GridView中LinkButton的确认框
- 12. LinkButton点击OnPreRender
- 13. MVC LinkButton等价
- 14. Flex LinkButton可选
- 15. 在DataList中隐藏LinkButton
- 16. 创建运行时的LinkButton
- 17. 的LinkButton的OnCommand问题
- 18. 如何使用JavaScript或JQuery在GridView中查找LinkButton?
- 19. 的LinkButton在ListView与CommandArgument
- 20. 错误动态的LinkButton
- 21. 的LinkButton在DataList控件
- 22. 为什么我的LinkButton在GridView内部不会引发OnClick事件?
- 23. 的GridView ButtonField字段作品的LinkButton不
- 24. 找到GridView控件LinkButton的值的jQuery
- 25. 使用ASP.NET AJAX的WebForms:HyperLink与来自GridView的LinkButton&Response.Redirect
- 26. 怎样的LinkButton的GridView控件内通过动态
- 27. GridView里面的LinkButton在UpdatePanel里触发全回发
- 28. linkButton:传递变量
- 29. LinkButton不起作用Silverlight
- 30. C#CommandRow LinkButton添加Javascript
行界事件
这段代码谢谢你的作品有小的变化。 – Vinod 2012-01-02 10:52:19