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

select value from combox and set into other text box

3 Answers 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vinh
Top achievements
Rank 1
Vinh asked on 14 Jul 2010, 06:40 PM
Hi,

I have a RadGrid with 2 column (customer_number, and customer_name). When I click on the Add New Record, I would like to build 2 combox (google like), 1 for customer_number and 1 for customer_name, both has 2 columns customer_number and customer_name and  when we select a value from either box, I would like to update the other box with its corresponding value.  These comboxes are pulling data from MS Access while this RadGrid is from SQL.

Thanks



3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 15 Jul 2010, 07:56 AM
Hello,


One suggestion is using GridTemplateColumns with RadComboBoxes in EditItemTemplate and then attach the OnSelectedIndexChanged event to comboboxes. Now in the OnSelectedIndexChanged event, get reference to other combo and set the SelectedValue accordingly.

I hope you will get hint on performing this by going through the following forum:
Load on demand with two comboboxes in grid


-Shinu.
0
Vinh
Top achievements
Rank 1
answered on 16 Jul 2010, 09:53 PM
Hi,

Thank you for your help, when I tried the thread you showed me above I got the following error

Microsoft JScript runtime error: 'RadComboBox1_OnSelectedIndexChanged' is undefined

ASPX
<telerik:RadComboBox runat="server" ID="RadComboBox1" DataTextField="CustomerNo" DataValueField="CustomerNo"
    HighlightTemplatedItems="true" Height="190px" Width="300px" DropDownWidth="420px"
    DataSourceID="AccessDataSource1" EnableAutomaticLoadOnDemand="true"
    ItemsPerRequest="10" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
    OnClientSelectedIndexChanged="RadComboBox1_OnSelectedIndexChanged">
    <HeaderTemplate>
        <ul>
            <li class="col1">CustomerNo</li>
            <li class="col1">Company</li>
            <li class="col1">City</li>
            <li class="col1">State</li>
        </ul>
    </HeaderTemplate>
    <ItemTemplate>
        <ul>
            <li class="col1"><%# DataBinder.Eval(Container.DataItem, "CustomerNo")%></li>
            <li class="col1"><%# DataBinder.Eval(Container.DataItem, "Company")%></li>
            <li class="col1"><%# DataBinder.Eval(Container.DataItem, "City")%></li>
            <li class="col1"><%# DataBinder.Eval(Container.DataItem, "State")%></li>
        </ul>
    </ItemTemplate>
</telerik:RadComboBox>

CS
protected void RadComboBox1_OnSelectedIndexChanged(object sender, EventArgs e)
{
    RadComboBox radCombo1 = (RadComboBox)sender;
    GridEditFormItem editItem = (GridEditFormItem)radCombo1.NamingContainer;
    TextBox txtCustomerNumb = (TextBox)editItem.FindControl("txtCustomerNumb");
    TextBox txtCustomerName = (TextBox)editItem.FindControl("txtCustomerName");
    .......
}

Thanks again

Vinh Vu
0
Daniel
Telerik team
answered on 22 Jul 2010, 12:17 PM
Hello Vinh,

Judging by the provided information, you are trying to wire a server event handler to a client side event. Please check whether the event name is spelled correctly - OnSelectedIndexChanged or OnClientSelectedIndexChanged.

Regards,
Daniel
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
Tags
Grid
Asked by
Vinh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Vinh
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or