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

Problem with Radlistbox with checkbox

2 Answers 154 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Jessy Joseph
Top achievements
Rank 1
Jessy Joseph asked on 03 May 2011, 09:59 PM

Hi,

When I load the radwindow for first time I want that one of my item in the Radlistbox with checkbox is checked.  I'm getting that item value from the Main page.  Currently with the below code I am able to select the row but the checkbox is not selected.

Client Side code

<telerik:RadListBox ID="Radlistbox" runat="server" CheckBoxes="true" Width="250px"
    Height="230px" DataSourceID="dsGetProducts" DataTextField="IDAndProduct" DataValueField="ProductID"
   Skin="Outlook" onitemcheck="Radlistbox_ItemCheck"  AutoPostBack="true"  OnClientItemChecked="OnClientItemChecked"
    OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" >
  </telerik:RadListBox>

                                               
Server side

    if (!Page.IsPostBack)
  
   {
  
Radlistbox.SelectedValue = Session["ProductID"].ToString();
  
      }              

 

Thanks

Jessy

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 May 2011, 05:57 AM
Hello Jessy,

Please try the following approach.
C#:
if (!Page.IsPostBack)
        {
            RadListBox1.SelectedValue = "1";
            RadListBoxItem item = RadListBox1.SelectedItem;
            item.Checked = true;
        }

Thanks,
Shinu.
0
Jessy Joseph
Top achievements
Rank 1
answered on 05 May 2011, 04:12 PM
Thanks Shinu,

It worked like magic :)

Jessy

Tags
ListBox
Asked by
Jessy Joseph
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jessy Joseph
Top achievements
Rank 1
Share this question
or