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