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

[Solved] Refreshing a RadComboBox Using Selected Item from Another RadCombox - Both in Edit Mode

1 Answer 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suresh Mishra
Top achievements
Rank 1
Suresh Mishra asked on 16 Sep 2009, 07:24 PM

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>

 

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 22 Sep 2009, 12:04 PM
Hi Suresh,

To see more information along the lines of the requested functionality, please refer to the following article:


Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Suresh Mishra
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or