Need ListBox - Checkbox checked event

7 posts, 0 answers
  1. Medac
    Medac avatar
    79 posts
    Member since:
    Sep 2008

    Posted 10 Nov 2009 Link to this post

    Hi,

    I have

    <

     

    telerik:RadListBox CheckBoxes="true"> On check of Checkbox I want enble and disable the buttons. I need to catch the checkbox click event at the server side. How can I implement this?

    Regards,
    Medac

     

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Nov 2009 Link to this post

    Hi Medac,

    A new server-side event " ItemChecked " is added in the latest version of RadListBox (RadControls for ASP.NET AJAX 2009.3 1103), which fired when an item checked state is changed. Download the latest version of RadListBox if you don't have and attach the event to accomplisgh the functionality that you need.

    Regards,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sourabh
    Sourabh avatar
    7 posts
    Member since:
    Jan 2012

    Posted 08 May 2012 Link to this post

    hi
    i have a one checkbox for eg. 'checkbox1' out of the listbox and i want to check all the checkboxes in the listbox when i check 'checkbox1 '
    how can i do that

    thankyou.
  5. Sourabh
    Sourabh avatar
    7 posts
    Member since:
    Jan 2012

    Posted 08 May 2012 Link to this post

    hi
    i have a one checkbox for eg. 'checkbox1' out of the listbox and i want to check all the checkboxes in the listbox when i check 'checkbox1 '
    how can i do that??

    thankyou.
  6. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 May 2012 Link to this post

    Hi Sourabh,

    Try the following code snippet.

    C#:
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
        {
            foreach(RadListBoxItem item in R.Items)
            {
                item.Checked = true;
            }
        }

    Hope this helps.

    Thanks,
    Princy.
  7. Sourabh
    Sourabh avatar
    7 posts
    Member since:
    Jan 2012

    Posted 08 May 2012 Link to this post

    thanks Princy for reply but there is a problem if i use this method i will have to keep autopostback=true which i dont want to. Is there any javascript for this???

    thankyou
    Sourabh.
  8. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 May 2012 Link to this post

    Hi Sourabh,

    Try the following JavaScript in OnClick event of CheckBox.

    ASPX:
    <asp:CheckBox ID="CheckBox1" runat="server" OnClick="OnClick();" />

    JS:
    <script type="text/javascript">
        function OnClick()
        {
            var chk = document.getElementById("CheckBox1");
            var list = $find("<%= RadListBox1.ClientID %>");
            if (chk.checked == true)
            {
                for (var i = 0; i < list.get_items().get_count(); i++)
                {
                    list.get_items().toArray()[i].check();
                }
            }
        }
    </script>

    Thanks,
    Princy.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017