如果选中复选框,如何仅选中一个复选框并突出显示该行 [英] how to check only one checkbox and highlight the row if checkbox checked

查看:67
本文介绍了如果选中复选框,如何仅选中一个复选框并突出显示该行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,



正在使用C#处理asp.net项目。



on my网页我有gridview与项目模板中的复选框,用户必须只能选择一个复选框,不能超过一个。



如果用户选中具有复选框的特定行,必须更改该背景颜色的行。



注意:如果在gridview中选中复选框,则突出显示gridview行。

用户只能选择一个复选框



请你帮我,谢谢。

Dear All,

am working on asp.net project using C#.

on my webpage i have gridview with checkboxes within item template, user must able to select only one checkbox, not more than one.

If user select that particular row with checkbox, the row of that background color must change.

Note : Highlight the gridview row, if checkbox selected in gridview.
User can select only one checkbox

Please can you help me, thanks in advance.

推荐答案

http://www.aspsnippets.com/Articles/ ASPNet-GridView-Highlight-Row-Change-Row-Color-on-CheckBox-Checked-and-MouseOver.aspx [ ^ ]


Walter的好文章。您可以禁用所有复选框,而不是选中所有复选框,如果您愿意,可以取消选中此方法中的所有其他选项
Good article of Walter. Instead of checking all checkboxes you can disable them preventing other choices or, if you want so, uncheck all other choices in this method


1。在gridview复选框控件必须有ID



2.设置复选框属性autopostback为true;



3 。在gridview中使用RowCommand检查复选框更新你的数据库字段值为复选框

使用commandargument和commandname



4在网格视图中rowdatabound事件定义控件一个用于复选框,另一个用于标签或文本框

,其中数据库表主键值绑定

现在再次存在该主键的访问记录



并通过if condition检查价值

并且如果为真则放置,则checkbox1.checked = true;否则为假;
1. in gridview checkbox control must have ID

2. set check box property autopostback is true;

3. in gridview RowCommand when used check on checkbox update your database field value for checkbox
using commandargument and commandname

4 In grid view rowdatabound event define controls one for checkbox and other for label or textbox
in which your database table primary key value bind
now again there access record for that primary key

and check value through "if condition"
and place if true then checkbox1.checked=true; else false;


这篇关于如果选中复选框,如何仅选中一个复选框并突出显示该行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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