Problem with Radlistbox with checkbox

3 posts, 0 answers
  1. Jessy Joseph
    Jessy Joseph avatar
    34 posts
    Member since:
    Mar 2010

    Posted 03 May 2011 Link to this post

    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 May 2011 Link to this post

    Hello Jessy,

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

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jessy Joseph
    Jessy Joseph avatar
    34 posts
    Member since:
    Mar 2010

    Posted 05 May 2011 Link to this post

    Thanks Shinu,

    It worked like magic :)

    Jessy

Back to Top