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

Grid: two data sources or data tables for one grid

1 Answer 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vassili King
Top achievements
Rank 1
Vassili King asked on 17 May 2010, 11:45 PM
Hello,

I'm trying to change the "Grid / Using Server-side API" demo to have the drop-down list pull data from a different data table or data source.

To illustrate the scenario, here is a theoretical example:

1. Lets say I have a stored proc called SP1 returning a list of customers who bought cars. The proc returns customer_id, customer_name and car_make_id.
2. Lets say I have another stored proc called SP2 that returns a list of the car makes (make_id and make_name).
3. Lets say I'm implementing a structure very similar to the "Grid / Using Server-side API" demo.

How could I arrange the bindings if I want the grid to show customer data based on the data from SP1 displaying a customer name (just a textbox - easy stuff) and a car make (a drop-down list with a list of all makes returned by SP2, with the customer's car make selected)?

To clarify the situation a little bit:

The demo is located here: http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/extractvalues/defaultcs.aspx
It has a drop-down box that is bound to the same datasource as everything else and therefore would not display a distinct list of items... or car makes in the example I've made up above. Instead it would just show a non-unique list of all make IDs associated with the customers so far (and would not show makes that exist in the Make database table, but haven't been yet associated with the customers).


Any help would be truly appreciated.

Thank you!

1 Answer, 1 is accepted

Sort by
0
Vassili King
Top achievements
Rank 1
answered on 18 May 2010, 06:00 PM
I've figured it out. I have a DataSet with two tables (each containing data returned by one of the two stored procedures. I bind all columns to the first table except for the drop-down, which I bind to the second table. To make sure the correct value is selected in the drop-down see that the value of the ListValueField property is the same in both tables.
Tags
Grid
Asked by
Vassili King
Top achievements
Rank 1
Answers by
Vassili King
Top achievements
Rank 1
Share this question
or