mercredi 21 décembre 2016

How to disable checkbox inside gridview?

Hi I am developing one application. I have one multiselect dropdownlist box. Whenever i select one value in dropdownlistbox corresponding value in gridview will be having checkbox in below gridview. I want to disable that checkbox. I am basically mvc developer and finding hard times to fix this. I am trying my level best to fix this. For example, whever i select some value in dropdown I am getting ID using jquery as below.

<script>
$(function() {
    $('.limitedNumbSelect2').change(function (e) {
        var selected = $(e.target).val();
    }); 
});

This is my gridview.

 <asp:GridView ID="gdvRegretletter" CssClass="tableform" runat="server" AutoGenerateColumns="False" DataKeyNames="Vendor_ID"
        EmptyDataText="No records found !" ShowHeaderWhenEmpty="true" AllowPaging="true" OnPageIndexChanging="gdvRegretletter_PageIndexChanging">
        <Columns>
 <asp:TemplateField ShowHeader="true" HeaderText="Select All">
                <HeaderTemplate>
                    <asp:CheckBox ID="checkAll" runat="server" Text="Check All" onclick="checkAll(this);" />
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="chkselect" runat="server" onclick="Check_Click(this)" />
                    <asp:HiddenField ID="id" runat="server" Value='<%#Eval("Vendor_ID")%>' />
                </ItemTemplate>
                <HeaderStyle Width="8%" />
                <ItemStyle VerticalAlign="Top" Width="8%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Username">
                <ItemTemplate>
                    <asp:Label ID="lblUsername" runat="server" Text='<%#Eval("Username") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Name">
                <ItemTemplate>
                    <asp:Label ID="lblName" runat="server" Text='<%#Eval("Name") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Email Id">
                <ItemTemplate>
                    <asp:Label ID="lblEmail" runat="server" Text='<%#Eval("Email") %>' />
                </ItemTemplate>
            </asp:TemplateField>
 </asp:GridView>

Whenecer i select some value from multiselect dropdownlist box I get id in a variable selected. As soon as I get ID in a variable selected i want to disable that checkbox in gridview. May i have some suggestions on this! Thank you all




Aucun commentaire:

Enregistrer un commentaire