views:

37

answers:

2

Hi,

As my previous question didn't seem to have much popularity, I decided to change completely the way I approached the problem. Now my issue is that I still have TABLE1 with a foreign key FK, but what I want to do now is have the FK column in the GridView display Dropdown Lists. The Dropdown Lists should have their Text property bound to FK in TABLE1 but they should be populated by the different values of FK (stored in TABLE2).

Any idea about how to achieve this ?

PS : Really new to data controls in ASP.Net

A: 

Create two SQL datasources, one for the parent table and one for the child table. Bind the gridview to the first one and the dropdown in the template to the second one. That should do the trick.

tdammers
A: 

1.Bring your Child table and parent table from database as Dataset
2.Assign the dataset as datasource for gridview (parent table (Dataset.Table["ParentTable"]))
3.Add your drop down in edit item template of grid view
4.While Selecting Dropdown identify the values of Dropdown & Query the Child table with selected value.
5.populate the detail in other field.
please use script manager & Update panel while doing this. that would be help full for you.

Ramakrishnan