This is a migrated thread and some comments may be shown as answers.

Need ListBox - Checkbox checked event

6 Answers 190 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Medac
Top achievements
Rank 1
Medac asked on 10 Nov 2009, 07:32 AM
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

 

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Nov 2009, 07:25 AM
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.
0
Sourabh
Top achievements
Rank 1
answered on 08 May 2012, 08:31 AM
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.
0
Sourabh
Top achievements
Rank 1
answered on 08 May 2012, 08:32 AM
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.
0
Princy
Top achievements
Rank 2
answered on 08 May 2012, 09:04 AM
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.
0
Sourabh
Top achievements
Rank 1
answered on 08 May 2012, 09:09 AM
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.
0
Princy
Top achievements
Rank 2
answered on 08 May 2012, 10:28 AM
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.
Tags
ListBox
Asked by
Medac
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sourabh
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or