从LinkButton的在GridView传递控件ID [英] Passing Control Id from Linkbutton in a gridview
本文介绍了从LinkButton的在GridView传递控件ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何通过控制ID在从存储过程导出到一个变量一个gridview。我将使用变量传递到数据库以后返回了一定的成效。谢谢你。
解决方案
VAR控件ID =((LinkButton的)gridView1.Rows [0] .FindControl(lbName))标识。
您试图做一些像上面?
更新
您可以使用GridView控件的事件OnSelectedIndex发现,这是选择的行。
无效GridView_SelectedIndexChanged(对象发件人,EventArgs的发送)
{
//获取使用SelectedRow属性当前所选行。
GridViewRow排= CustomersGridView.SelectedRow; VAR控件ID =((LinkButton的)row.FindControl(lbName))标识。
}
How do I pass the Control ID in a gridview that is derived from a stored procedure into a variable. I will use the variable to pass into the database later on to return some results. Thanks.
解决方案
var controlId = ((LinkButton)gridView1.Rows[0].FindControl("lbName")).Id;
Are you trying to do something like the above?
Update
You can use the OnSelectedIndex event of the GridView to find the row that was select.
void GridView_SelectedIndexChanged(Object sender, EventArgs e)
{
// Get the currently selected row using the SelectedRow property.
GridViewRow row = CustomersGridView.SelectedRow;
var controlId = ((LinkButton)row.FindControl("lbName")).Id;
}
这篇关于从LinkButton的在GridView传递控件ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文