asp.net GridView控件 - 选择行 [英] asp.net gridview - select row

查看:386
本文介绍了asp.net GridView控件 - 选择行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待能够以选择一行点击一个gridview的行,而不是使用选择的链接。

I'm looking to be able to click on a gridview row in order to select a row rather than use the select link.

我有code下面这使得该行可点击和行为像一个超链接.....

I have the code below which make the row clickable and act like a hyperlink.....

    Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)

    If (e.Row.RowType = DataControlRowType.DataRow) Then
        e.Row.Attributes.Add("onmouseover", "this.style.cursor='hand';this.style.textDecoration='underline';")
        e.Row.Attributes.Add("onmouseout", "this.style.textDecoration='none';")
        e.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(Me.GridView1, "Select$" + e.Row.RowIndex.ToString()))
    End If

    End Sub

....但后来我得到的错误信息:

....but then I get the error message:

无效的回发或回调参数。在一个页%@页EnableEventValidation =真%>;事件验证正在使用中配置或所述启用。为了安全起见,此功能验证参数回发或回调事件,从最初呈现这些事件的服务器控件。如果数据是有效的和预期,使用ClientScriptManager.RegisterForEventValidation方法来注册回发或回调数据以进行验证。

Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

任何人都知道如何克服呢?

Anyone know how to overcome this?

谢谢,

推荐答案

感谢您的帮助找到了答案另一种方式......而不是使用visibility属性
我的显示属性设置为无,一切工作就像...

Thanks for help had found the answer another way...rather than use the visibility property I set the display property to none and everything worked as is...

<asp:CommandField ShowSelectButton="True" ItemStyle-CssClass="HiddenColumn" HeaderStyle-CssClass="HiddenColumn"/>


.HiddenColumn{display:none;}

这篇关于asp.net GridView控件 - 选择行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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