Related Radcombobox

2 posts, 0 answers
  1. Shweta malpani
    Shweta malpani avatar
    6 posts
    Member since:
    Jan 2010

    Posted 21 Jul 2010 Link to this post


    I have a group of Combobox and I am trying to set values of ComboBox B at server side  based on selected values of ComboBox A.

     

    <tr>

     

     

    <td align="right">

     

     

    <asp:Label ID="Label1" runat="server" Text="Release Name:"></asp:Label>

     

     

    <br />

     

     

    </td>

     

     

    <td align="left">

     

     

    <telerik:RadComboBox ID="RadRelease" runat="server" Width="240px" EmptyMessage="Please select Type"

     

     

    AutoPostBack="true" OnSelectedIndexChanged="RadRelease_Changed" EnableLoadOnDemand="true"

     

     

    OnItemsRequested="Release_ItemsRequested" ShowMoreResultsBox="true" EnableVirtualScrolling="true"

     

     

    > </telerik:RadComboBox>

     

     

    </td>

     

     

    </tr>

     

     

    <tr>

     

     

    <td align="right">

     

     

    <asp:Label ID="LblSCRName" runat="server" Text="SCR Name:"></asp:Label>

     

     

    <br />

     

     

    </td>

     

     

    <td align="left">

     

     

    <telerik:RadComboBox ID="RadSCR" runat="server" Width="240px" EmptyMessage="Select a Description"

     

     

    EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true"

     

     

    OnItemsRequested="Project_ItemsRequested" >

     

     

    </telerik:RadComboBox>

     

     

    </td>

     

     

    </tr>


    Server Side code

     

     

     

     

     

     

    protected void Release_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)

     

    {

     

    //sys = (string)ViewState["sys"];

     

     

     

     

     

     

    SCRObj objscr = new SCRObj();

     

     

    DataTable data = objscr.GetReleaseInfo(e.Text,sys, RadReleaseType.SelectedItem.Text);

     

    RadRelease.Items.Clear();

     

    int itemOffset = e.NumberOfItems;

     

     

    int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);

     

    e.EndOfItems = endOffset == data.Rows.Count;

     

    for (int i = itemOffset; i < endOffset; i++)

     

    {

    RadRelease.Items.Add(

    new RadComboBoxItem(data.Rows[i]["RELEASE_NAME"].ToString(), data.Rows[i]["RELEASE_NAME"].ToString()));

     

    }

     

     

    //e.Message = GetStatusMessage(endOffset, data.Rows.Count);

     

     

     

     

     

    }

     

    protected void Project_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)

     

    {

     

    SCRObj objscr = new SCRObj();

     

     

    DataTable data = objscr.GetProjectInfo(e.Text, sys, RadReleaseType.SelectedItem.Text,

     

    RadRelease.SelectedItem.Text

    );

     

    int itemOffset = e.NumberOfItems;

     

     

    int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);

     

    e.EndOfItems = endOffset == data.Rows.Count;

     

    for (int i = itemOffset; i < endOffset; i++)

     

    {

    RadSCR.Items.Add(

    new RadComboBoxItem(data.Rows[i]["RELEASE_NAME"].ToString(), data.Rows[i]["RELEASE_NAME"].ToString()));

     

    }

     

     

    //e.Message = GetStatusMessage(endOffset, data.Rows.Count);

     

     

     

     

     

    }


    In this code above, I am getting RadRelease.SelectedItem as null.

    Please let me know if I am doing anything wrong or any examples of related combobox with server side code.

    thanks
    SM

     

  2. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 26 Jul 2010 Link to this post

    Hello Shweta malpani,

    Since Load-On-Demand feature fires at client-side when the user types in the input area or clicks on the drop-down toggle image (when there are no items in the RadComboBox) - using Load-On-Demand while implementing relation between RadComboBox controls only at server-side is not quite suitable.

    I can suggest you remove the Load-On-Demand from the "RadSCR" RadComboBox control and databind this control within the SelectedIndexChanged event handler of "RadRelease" RadComboBox.
    Please find more details at the sample page attached.

    Best wishes,
    Kalina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top