验证GridView中的复选框 [英] Validating check boxes in a gridview

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

问题描述

大家好,

我是asp.net的新手,我敢肯定我的问题可能很简单,

我正在网格视图中创建两个复选框列.我要的是用户只能检查
每行只有一列,如果用户选择两者,我想显示一条消息,我想在客户端处理它,没有回发到服务器的帮助,

问候,

Hi guys ,

I am new to asp.net, i am sure my problem might be pretty simple ,

I am creating two check box columns in a grid view.What i want is user can only check
only one column in each row ,i want to show a message if a user selects both,i want to handle it at client side no post back to server, any help ?

regards,

推荐答案

下面的链接将为您提供概念.
http://forums.asp.net/t/1648139.aspx/1?Validate + multiple + checkbox + in + each + row + of + gridview [ ^ ]
Following link will provide you the concept.
http://forums.asp.net/t/1648139.aspx/1?Validate+multiple+checkbox+in+each+row+of+gridview[^]


您可以使用模板列,用于添加复选框和更改事件的JavaScript处理程序.或者,您可以在使用JavaScript渲染后添加事件处理程序. jQuery在这两种情况下都将非常有帮助.
You can use a Template column to add the checkboxes and a JavaScript handler for the change event. Or you could add the event handlers after rendering using JavaScript. JQuery would be very helpful in both cases.


是的,我同意Mark的观点.您可以在客户端或服务器端进行操作.将该复选框放在Template Field中.如果要在服务器端脚本中执行此操作,请使用FindControl Methods从GridViewRow 读取CheckBox 值.我会建议使用Javascript / JQuery. Attach a Script处理程序,同时与row绑定.这将使事情变得非常简单.
Yes, I am agree with Mark. You can do it either of Client or Server side. Put the checkbox in Template Field. If you want to do it in server side scripting, Read the CheckBox value from GridViewRow using FindControl Methods. I will suggest for Javascript / JQuery . Attach a Script handler while binding with row . That will make thing very simple.


这篇关于验证GridView中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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