Take the 2-minute tour ×

I've checked all the answers but my problem seems different - i have two sets of checkbox list. On startup, i disable all checkboxes from the second set.

rotected void exchList_OnDataBound(object sender, EventArgs e)
    for (int i = 0; i < exchList.Items.Count; i++)
        exchList.Items[i].Attributes.Add("onclick", "gridCallback();");
        exchList.Items[i].Enabled = false;
    }//end for
}//end exchList_OnDataBound()

Checking a box in the first set enables boxes in another. This is done via jquery.

$('#<%= exchList.ClientID %> input:checkbox').each(function() {
            $label = $(this).parent().children("label").text();
            i = 0;
            while(i < $jsonData.xxx.length)
                if ($(this).attr('disabled'))
                }//end if
            }//end else
            }//end while

While the boxes to become checked, during the callback it is not detected.

protected void productGrid_OnCustomCallback(object sender,
                        DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
    String markets = "", exchs = "";
    int i;
    for (i = 0; i < marketList.Items.Count; i++)
        if (marketList.Items[i].Selected)
    }//end for

    for (i = 0; i < exchList.Items.Count; i++)
        System.Diagnostics.Debug.WriteLine(exchList.Items[i].Text + " " + exchList.Items[i].Enabled);
    }//end for
}//end productGrid_OnCustomCallback()

They are always not checked even when the checkboxes are clearly checked. Looking at firebug shows that because i disabled and enabled the list items, the checkboxes are encapsulated by a DIV, and this might be causing the issue. I tested it without the disable / enable, and the HTML had no DIV surrounding the checkboxes, and now it works properly. How do i get the checkbox checked value inside the DIV from the listitem?

share|improve this question

2 Answers 2

if I remember correctly, it's some sort of bug of the ASP.net controls that if a checkbox is disabled on page load, it always returns as unchecked, even if you enabled it and checked it on client side.
A workaround for this would be to send the checkboxes enabled from the server side, and disable them, if necessary, on loading on the client side.

IMHO, a prefferable solution would be, of course, to not use ASP.net controls at all, as I find them overly complex and overweight. but hey- that's just me...

share|improve this answer
but how else can i generate a checkbox list without using asp.net checkboxlist? i dun wanna use javascript ... –  Ron Jun 21 '11 at 1:12
well, if you don't want to use client-side code to generate controls on client side, then... yeah, you're pretty much stuck with server side controls :). Personally I use a lot of javascript (actually- jQuery) and it has many controls which are much simpler, easier to use, and efficient, then asp.net ones. i'd recommend you give it a chance... –  sJhonny Jun 21 '11 at 9:25

try these codes I use using checkboxlist. it uses 2 pages. NO jscript code.. hope this helps. 1st page cs code.

Session["checkedarray"] = new string[] { "1.0", "2.0", "3.0" };
                    string[] checkedlist = new string[17];
                    int a = 0;

                        if (cblist1.Items[i].Selected == true)
                            checkedlist[a] = cbllist1.Items[i].ToString();
                            a = a + 1;

                    Session["checkedarray"] = checkedlist;
                    Session["numofchecked"] = a;

2nd page cs code.

protected void Page_Load(object sender, EventArgs e)
    string[] arr = (string[])Session["checkedarray"];

    for (int i = 0; i < int.Parse(Session["numofchecked"].ToString()); i++)
share|improve this answer

Your Answer


