I have to rad combo boxes, RadLaborSchedule (rad1) and RadLaborCatDesc (rad2). Both these rad combo boxes are declared as EditItems in a radgrid. How do I populate rad2 with selected value of rad1?
I tried using this code in javascript, which errors out at compile time because RadLaborCatDesc can not be found, being an edit item of a rad grid.
Thanks.
Suresh
Here is the javascript:
//global variables for the countries and cities comboboxes
var LaborCatCombo;
function pageLoad()
{
// initialize the global variables
// in this event all client objects
// are already created and initialized
LaborCatCombo = $find(
"<%= RadComboBoxLaborCatDesc.ClientID %>");
}
function LoadLaborCategories(combo, eventArqs)
{
var item = eventArqs.get_item();
LaborCatCombo.set_text(
"Loading...");
LaborCatCombo.clearSelection();
// if a labor schedule is selected
if (item.get_index() > 0)
{
// this will fire the ItemsRequested event of the
// countries combobox passing the continentID as a parameter
LaborCatCombo.requestItems(item.get_value(),
false);
}
else
{
// the -Select a continent- item was chosen
LaborCatCombo.set_text(
" ");
LaborCatCombo.clearItems();
}
}
And this is the radgrid declaration:
<telerik:GridTemplateColumn DataField="LaborSchedule" HeaderText="Labor Schedule" UniqueName="LaborSchedule">
<ItemTemplate >
<asp:Label id="LabelLaborSchedule" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "LaborSchedule")%>'
></asp:Label>
</ItemTemplate>
<ItemStyle Width="500px" />
<EditItemTemplate>
<telerik:RadComboBox DataTextField="LaborSchedule"
DataValueField="LaborSchedule"
AutoPostBack="false"
EnableLoadOnDemand="True"
ID="RadComboBoxLaborschedule"
runat="server"
Height="140px"
Width="100px"
SelectedValue = '<%#DataBinder.Eval(Container.DataItem, "LaborSchedule")%>'
SelectedText = '<%#DataBinder.Eval(Container.DataItem, "LaborSchedule")%>'
DataSourceId = "ObjectDataSourceGetSchedules"
OnItemsRequested= "RadComboBoxLaborschedule_ItemsRequested"
OnClientSelectedIndexChanging="LoadLaborCategories"
>
</telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="LaborCategoryDesc" HeaderText="LaborCategoryDesc" UniqueName="RadComboBoxLaborCatDesc">
<ItemTemplate>
<asp:Label id="LabelLaborCategoryDesc" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "LaborCategoryDesc")%>'
></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox ID="RadComboBoxLaborCatDesc" runat="server"
DataTextField="LaborCategoryDesc"
DataValueField="LaborCategoryCode"
SelectedValue = '<%#DataBinder.Eval(Container.DataItem, "LaborCategoryCode")%>'
SelectedText = '<%#DataBinder.Eval(Container.DataItem, "LaborCategoryDesc")%>'
DataSourceId = "ObjectDataSourceLabelCategory"
OnItemsRequested= "RadComboBoxLaborCatDesc_ItemsRequested"
AutoPostBack="false"
>
</telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>