如何在单击行时选择一个gridview行? [英] how to select a gridview row on clicking the row ?..

查看:86
本文介绍了如何在单击行时选择一个gridview行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,

我想一次通过单击gridview row选择一次一行.我正在RowDataBound事件下执行此操作-

hey there,

i want to select a single row at a time by clicking on a gridview row.i am doing this under RowDataBound event --

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
       {
           if (e.Row.RowType == DataControlRowType.DataRow)
           {
               e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.textDecoration='underline';";
               e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
               e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex);
           }
       }




但它不起作用,它显示错误-无效的回发或回调参数.

谢谢
Amit




but its not working.Its showing error - Invalid postback or callback argument.

thanks
Amit

推荐答案

" + e.Row.RowIndex); } }
" + e.Row.RowIndex); } }




但它不起作用,它显示错误-无效的回发或回调参数.

谢谢
Amit




but its not working.Its showing error - Invalid postback or callback argument.

thanks
Amit


尝试使用Page.ClientScript.GetPostBackEventReference而不是ClientScript.GetPostBackClientHyperlink

看一下这篇文章:开发可点击行的GridView [ ^ ]
在VB.NET中,但概念相同.
Try using Page.ClientScript.GetPostBackEventReference instead of ClientScript.GetPostBackClientHyperlink

Have a look at this article: Developing a row-clickable GridView[^]
It''s in VB.NET but concept is same.


this[^] might help you.


这篇关于如何在单击行时选择一个gridview行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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