GridView选择而没有选择按钮 [英] GridView select without select button

查看:99
本文介绍了GridView选择而没有选择按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


没有选择按钮,有没有办法在gridview中选择项目.请帮助

我尝试过此代码

protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
if (e.Row.RowType == DataControlRowType DataRow) 
{ 
e.Row.Attributes["OnClick"] = ClientScript.GetPostBackEventReference(this, "Select$" + e.Row.RowIndex); 
}


但不会转到所选的索引更改事件

在此先感谢
Nidhin

解决方案

"+ e.Row.RowIndex); }


但不会转到所选的索引更改事件

在此先感谢
Nidhin


您附加了错误的事件.试试这个:

 受保护的 无效 GridView_RowDataBound(对象发​​件人,GridViewRowEventArgs e)
{
   如果(例如,Row.RowType == DataControlRowType.DataRow)
   {
     e.Row.Attributes [" ] =
     ClientScript.GetPostBackClientHyperlink( .myGridView,"  + e.Row.RowIndex);
   }
} 



然后每一行的行为就像一个链接.


hi
Is there any way to select the item in gridview without the select button. Plz help

I tried this code

protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
if (e.Row.RowType == DataControlRowType DataRow) 
{ 
e.Row.Attributes["OnClick"] = ClientScript.GetPostBackEventReference(this, "Select$" + e.Row.RowIndex); 
}


but not going to the selected index changing event

Thanks in advance
Nidhin

解决方案

" + e.Row.RowIndex); }


but not going to the selected index changing event

Thanks in advance
Nidhin


You had attached wrong event. Try this:

protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
   if (e.Row.RowType == DataControlRowType.DataRow)
   {
     e.Row.Attributes["onclick"] =
     ClientScript.GetPostBackClientHyperlink(this.myGridView, "Select


" + e.Row.RowIndex); } }



Each row will then behave like a link.


这篇关于GridView选择而没有选择按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆