lundi 26 décembre 2016

How to disable checkbox inside the gridview in asp.net?

I am developing one asp.net application. I have one multiselect dropdownlistbox. I have implemented this using jquery choosen pluging. User can select more than one value from dropdownbox at a time. I have one gridview below to dropdownlistbox. Logic here is values i binded to dropdownbox is equal to one of the column of gridview. This is my dropdownlistbox.

 <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="false" 
         CssClass="limitedNumbSelect2" Multiple="True" >
                <asp:ListItem Text="Select Gender" Value="0"></asp:ListItem>
                <asp:ListItem Text="Niranjan" Value="1"></asp:ListItem>
                <asp:ListItem Text="balaji" Value="2"></asp:ListItem>
                <asp:ListItem Text="Neenu" Value="3"></asp:ListItem>
                <asp:ListItem Text="Lindhana" Value="4"></asp:ListItem>
    </asp:DropDownList>

This is my code to select multiple values from dropdownlistbox.

$(document).ready(function () {
        $(".limitedNumbSelect2").chosen({
            placeholder_text_multiple: "Please select Names here"
        })
    });

This is my clientside gridview code.

<asp:GridView ID="GridView1" runat="server" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
    AutoGenerateColumns="false">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:CheckBox ID="chkRow" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="150" />
        <asp:TemplateField HeaderText="Country" ItemStyle-Width="150">
            <ItemTemplate>
                <asp:Label ID="lblCountry" runat="server" Text='<%# Eval("Country") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

This is my server side code to populate gridview.

if (!this.IsPostBack)
            {
                DataTable dt = new DataTable();
                dt.Columns.AddRange(new DataColumn[2] { new DataColumn("Name"), new DataColumn("Country") });
                dt.Rows.Add("Niranjan", "Canada");
                dt.Rows.Add("balaji", "United States");
                dt.Rows.Add("Neenu", "China");
                dt.Rows.Add("Lindhana", "India");
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }

Using jquery I want to disable the checkboxes of gridview. This is the below code for disable checkbox.

$(function () {
            $('.limitedNumbSelect2').change(function (e) {
                var selected = '';
                selected = $("#DropDownList1 option:selected").text();
                disableUsers(selected);
            });
        });
        function disableUsers(selected)
        {
            temp = selected.split(",");
            $.each(temp, function (index, value) {

            });
        }

Whenever i select Niranjan from dropdownlistbox I want to disable checkbox of corresponding row from gridview. I want to disable row of the gridview. May i get some help on this. Thank you all.




jstree : seleted all or checked all

how can i checked all the checkboxes that appear in jstree, when derived code like this? and when you click the group will change all the checked based group

$(function() {
    
    // transform menutree div
   var menutree = $('#menutree').jstree({
                       "plugins": ["types", "checkbox"],
                                'core': {
                                 //"load_open": true,
                                    "data": {
                                        "async": false,
                                        'cache': false,
                                        'dataType': 'JSON',                        
                                        'url':json_menu_url,
                                        'data': function(node) {
                                           
                                            
                                        },
                                        'success': function(r){
                                                console.log(r)
                                        }
                                    },
                                },
                         });

           
            $(document).on('dnd_stop.vakata', function (e, data) {
                console.log('--drop--');
            });

});

and data json enter image description here




How can I add checkbox in UITextView

I am making a TextView similar as iOS Notes app and EverNote. and I want to add clickable checkbox list in EditableUITextView. I tried UIGestureRecognizer, but it didn't helped a lot. So is there are some way to add CheckBox to UITextView?

please help!!




Materializecss's checkbox input not working with jQuery

I am building the Simon game, and I'm using two sets of checkbox inputs from the Materialize.css library.

As shown in the official docs, here's the snippet for the checkbox -

<p>
  <input type="checkbox" id="test5" />
  <label for="test5">Red</label>
</p> 

The problem is, it doesn't seem to work at all when I try to detect if the checkbox is checked, using jQuery. I have tried both is(":checked") and prop("checked"), but neither works.

/**
 * Created by manishgiri on 12/26/16.
 */
$(document).ready(function () {
    if($("#start").is(":checked")) {
        console.log("inside");
        console.log("Start is checked");
    }
    if($("#start").prop("checked")) {
        console.log("inside");
        console.log("Start is checked");
    }
    //console.log("outside");
});
<link href="http://ift.tt/2hRiGD3" rel="stylesheet"/>
<script src="http://ift.tt/1oMJErh"></script>

<p>
      <input type="checkbox" id="start" />
      <label for="start">Start</label>
    </p>

Here's the complete app on Codepen. I would appreciate any help!




Assigning unique models and ids to checkboxes within ng-repeat

I'm trying to understand data-binding with AngularJs and I'm working on a simple form that uses ng-repeat to render a set of accordions. The headings of each accordion has a status box that is red by default, yet when the accordion is expanded, checking the checkbox within should turn the status box green.

The problem I'm having is that when I check a checkbox, it turns the status box of each accordion heading green; not just the status box relevant to the checkbox.

I know I need to assign a unique model to each status box/checkbox but I'm unsure how. I've seen some examples with $index but I haven't been able to apply it to my problem.

The HTML is as follows:

<ul class="radio-accordion">
<li class="radio-accordion-item" ng-repeat="animal in ctrl.animalTypes">
    <input id="input" type="checkbox" name="input" />
    <div class="radio-accordion-header grey">
        <div class="radio-accordion-header-left">
            <div class="radio-accordion-header-title-wrapper">
                <span class="status-led "></span>
                <h1 class="radio-accordion-header-title text-blue"></h1>
            </div>
        </div>
        <div class="radio-accordion-header-right"></div>
        <label class="expander-blue" for="input"></label>
    </div>
    <div class="radio-accordion-body white">
        <div class="padd-10 marg-left40">             
            <div class="toolbar-flex marg-top-10 marg-bott0">
                <input class="restyled"
                       id="input"
                       name="input"
                       type="checkbox"
                       ng-model="ctrl.checkedStatus"
                       ng-change="ctrl.setConsent()"
                       ng-true-value="'green'"
                       ng-false-value="'red'" />
                <label class="restyled-label"
                       for="input"><em>I like this animal</em></label>
            </div>
        </div>
    </div>
</li>

`

Any help appreciated!




Not able to select check box for dynamic input id value

below is the html script for two check box .And my intention is to select checkbox using their label as 'XERU' or 'SYM' . and in robot framework 'Checkbox Should Be Selected' is uses Key attributes for checkboxes are id and name, but here Id is dynamic for each label.so need to frame xpath for Check box selected using ID but but not hard coded value. XERU
SYM




How to show an EditText on checking Check Box in Android Activity?

I want to add check box in my android activity such that when the check box is checked one more editText should appear in the activity.. Please tell me how to do that. Thank You