标签: checked

C#Datagridview Checkbox Checked Event - 多行?

我有一个包含多个列和行的datagridview.第一列包含一个复选框.我希望用户能够选择多个复选框,然后执行操作.例如,如果他们选择第1行和第2行中的复选框,则可以选择第1行和第2行中其他列的数据并将其传递到消息框中.

我知道我需要使用checkbox_changed事件来执行此操作.但是,我在解决如何为多行执行此操作时遇到问题?

c# checkbox datagridview checked

2
推荐指数
1
解决办法
3万
查看次数

jQuery Selector - 检查和类开头

我需要获取第一个复选框的值,该复选框被检查,谁的类名称以'rqc'开头,例如.rqc205

我试过这个: requestID=$('#requestsTable').find('input[class^='rqc']:checked').val();

但它没有产生任何效果,requestID=$('#requestsTable').find('input:checked').val();但有效但不限于课程.

javascript jquery class selector checked

2
推荐指数
1
解决办法
3932
查看次数

选择另一个后无法取消选中单选按钮

这是我的设置:如果radiobutton1在页面加载时已经检查过(它checked="checked"在视图源中)并且我在选择后尝试取消选中,则在选择后radiobutton2,checked属性on radiobutton1不会被删除radiobutton2:

if($('#' + radiobutton1_ID).is(':checked'))
    UncheckRadioButton('#' + radiobutton2_ID);

// Utility function to clear a radiobutton's "checked" attribute
function UncheckRadioButton(radiobuttonID) {
    radiobuttonID.removeAttr("checked"); 
}
Run Code Online (Sandbox Code Playgroud)

选择后radiobutton2,做一个"查看源文件"我没有看到checked="checked"radiobutton2(即使页会显示该按钮选中),并为radiobutton1它仍然显示checked="checked".这是为什么?它应该是相反的方式.


UPDATE

这是我的一些代码.我知道if声明部分被击中,所以这不是问题,我知道我使用的单选按钮ID(ccRadioBtn,checkRadioBtnpaypalRadioButton)是正确的:

    var ccRadioBtn = ccRadioButton; // credit card radio button ID
    var paypalRadioButton = payPalRadioClientID;

    // ...

    if (paypalIsSelected()) {
        UncheckRadioButton(checkRadioBtn);
        UncheckRadioButton(ccRadioBtn);

        // ...
    } …
Run Code Online (Sandbox Code Playgroud)

jquery radio-button checked

2
推荐指数
1
解决办法
395
查看次数

使用标记/样式刷新UI按钮的"咏叹调"

我正在使用带有样式UI按钮 - 像| B | 我| U | 在此示例页面中,生成的html结构如下所示:

<div class="radiocheck ui-buttonset">
<input type="radio" name="radio1" value="1" id="radio0" class="ui-helper-hidden-accessible">
<label for="radio0" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-left" role="button" aria-disabled="false">
    <span class="ui-button-text">Sobre</span>
</label>
<input type="radio" name="radio1" value="2" id="radio1" class="ui-helper-hidden-accessible">
<label for="radio1" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only" role="button" aria-disabled="false">
    <span class="ui-button-text">Politica</span>
</label>
<input type="radio" name="radio1" value="3" id="radio2" class="ui-helper-hidden-accessible">
<label for="radio2" aria-pressed="true" class="ui-button ui-widget ui-state-default ui-button-text-only" role="button" aria-disabled="false">
    <span class="ui-button-text">Outros</span>
</label>
<input type="radio" name="radio1" value="4" id="radio3" class="ui-helper-hidden-accessible">
<label for="radio3" aria-pressed="false" …
Run Code Online (Sandbox Code Playgroud)

checkbox label jquery-ui uilabel checked

2
推荐指数
1
解决办法
1万
查看次数

保持复选框以PHP格式检查

我知道如何在出现错误时保持表单提交复选框,但我现在有一个不同的问题.我正在使用同名的复选框,人们可以点击1或多个.我希望它只是保持复选框的用户签填写如果有喜欢的,如果他们检查q1中的Q1B一个问题,但不是Q1C我只想Q1 A和Q1B上的错误再装入时表现出检查.现在,在出错时,将检查所有相同名称的复选框.我已经尝试将名称更改为q1 [],但这不起作用.你能看一下,让我知道如何解决这个问题吗?

这是我的代码.

    <tr>
<td style="width: 124px" class="style15">Tape Recorder<?php    if(isset($problems['tape[]'])) {?><font color="red">*</font><?php } ?></td>
<td class="style9"> 
    <input name="tape[]" id="tape1" type="checkbox" value="used before," <?php   if(isset($_POST['tape[]'])) echo "checked"; ?> 
  </td>
<td class="style9"> 
    <input name="tape[]" id="tape2" type="checkbox" value="helpful in past,"        <?php   if(isset($_POST['tape[]'])) echo "checked"; ?> </td>
<td class="style9"> 
    <input name="tape[]" id="tape3" type="checkbox" value="requesting from DACC" <?php if(isset($_POST['tape[]'])) echo "checked"; ?> </td>
<td class="style9"> 
    <input name="tape[]"  id="tape4" type="checkbox" value="NA" <?php if(isset($_POST['tape[]'])) echo "checked"; ?></td>
 </tr>
  <tr>
        <td style="width: 124px">Note Taker <?php if(isset($problems['note'])) {?> …
Run Code Online (Sandbox Code Playgroud)

php forms checkbox checked

2
推荐指数
1
解决办法
8813
查看次数

正确的方式知道是否选中了复选框

可能重复:
检查是否使用jQuery选中了复选框

关于类型复选框的输入如何工作,我有点困惑.

如果我在复选框上设置一个值,比如1,我看到无论是否选中复选框,我提交表单时获得的值为1.

<input type="checkbox" value="1">
Run Code Online (Sandbox Code Playgroud)

那么,查看是否选中复选框的正确方法是使用checkedfrom jQuery?或者如何正确完成?

html checkbox jquery checked

2
推荐指数
1
解决办法
5695
查看次数

.NET checkbox.Checked总是返回false

我是.NET的新手,我的复选框有问题.即使选中它们,它们都会返回错误.这是我的asp代码

   <asp:GridView ID="gvGeneros1" runat="server" class="divTable" 
        AutoGenerateColumns="False" DataKeyNames="idgenero" CssClass="table">
        <Columns>
            <asp:BoundField DataField="nome" HeaderText="Gênero" SortExpression="nome" >
            <ControlStyle Width="200px" />
            <ItemStyle Width="200px" />
            </asp:BoundField>
            <asp:TemplateField AccessibleHeaderText="Check">
                <ItemTemplate>
                    <asp:CheckBox ID="checkGenero" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
Run Code Online (Sandbox Code Playgroud)

这是我的c#代码

DataSet dsDivided;

protected void Page_Load(object sender, EventArgs e)
{
    Music musicbll = new Music();
    DataSet dsGeneros = musicbll.getGenders();

    int size = dsGeneros.Tables[0].Rows.Count;
     dsDivided = null;

        // Divide in two DataTable
        dsDivided = Tools.SplitDataTableInTwo((DataTable)dsGeneros.Tables[0], size / 2);

    gvGeneros1.DataSource = dsDivided.Tables["FirstSet"];
    gvGeneros1.DataBind();

    for (int i = 0; i < …
Run Code Online (Sandbox Code Playgroud)

.net c# checkbox checked

2
推荐指数
1
解决办法
5755
查看次数

回发后,复选框不会更改其选中的值

我有一个复选框,从中我得到了检查值,但第一次工作得很好但后来我在回发后根本没有改变,总是返回true.

我只是这样做

bool accepted = this.chkAccepted.Checked;
Run Code Online (Sandbox Code Playgroud)

我的复选框位于控件内.不是直接在页面中转发.

<asp:CheckBox ID="chkAccepted" runat="server" Checked="true"/>Accepted
Run Code Online (Sandbox Code Playgroud)

第一次启动check = true.我点击我的按钮第一次回发并正常工作,然后我取消选中,单击我的按钮,但检查仍然是真的.

第一次启动check = true.我取消选中复选框,然后我点击我的按钮第一次回发并正常工作,然后我检查,单击我的按钮但检查结果为真,然后我再次取消选中并始终检查=真.

那么,这有什么问题呢?

我在同一个控件中有另一个复选框,没有初始化Checked属性,总是正常工作.那我该如何解决这个问题呢?

c# asp.net checkbox checked

2
推荐指数
1
解决办法
1万
查看次数

获取按名称检查的复选框数量

我试图找出已经检查了多少个复选框但是遇到了一些麻烦..

我的复选框都已命名delete[].

var count = ($('#form_store_setup input[name=delete]:checked').length);
Run Code Online (Sandbox Code Playgroud)

......这根本不起作用:

var count = ($('#form_store_setup input[name=delete[]]:checked').length);
Run Code Online (Sandbox Code Playgroud)

javascript checkbox jquery checked

2
推荐指数
1
解决办法
73
查看次数

如何设置自定义元框中的单选按钮?

我创建了一个自定义元框,您可以从一些单选按钮中选择一个值并将其保存到wordpress数据库中的post_meta表.使用以下代码我保存值:

function save_value_of_my_custom_metabox ($post_id, $post){
    $post_id = get_the_ID();
    $new_meta_value = ( isset( $_POST['the_name_of_the_radio_buttons'] ) ? sanitize_html_class( $_POST['the_name_of_the_radio_buttons'] ) : '' );
    $meta_key = 'my_key';
    update_post_meta( $post_id, $meta_key, $new_meta_value );
}
Run Code Online (Sandbox Code Playgroud)

但如果再次编辑帖子,我想要设置选中当前值的单选按钮.最好的方法是什么?这是显示元框的功能:

function my_custom_meta_box( $object, $box ) {
    $post_id=get_the_ID();
    $key='my_key';
    $the_value_that_should_be_set_to_checked=get_post_meta( $post_id, $key);
    //$the_value_that_should_be_set_to_checked[0] returns the value as string
    ?>    
    <label for="my_custom_metabox"><?php _e( "Choose value:", 'choose_value' ); ?></label>
    <br />  
      <input type="radio" name="the_name_of_the_radio_buttons" value="value1">Value1<br>
      <input type="radio" name="the_name_of_the_radio_buttons" value="value2">Value2<br>
      <input type="radio" name="the_name_of_the_radio_buttons" value="value3">Value3<br>
      <input type="radio" name="the_name_of_the_radio_buttons" value="value4">Value4<br>

        <?php
}
Run Code Online (Sandbox Code Playgroud)

我可以写出类似于if(isset($the_value_that_should_be_set_to_checked[0])=="value of …

wordpress radio-button checked meta-boxes

2
推荐指数
1
解决办法
1万
查看次数