Hi,

Can we have a datagrid, that is tied to multiple data sources. Usually a datgrid is tied to a table. So, if my datagrid has 4 fields/columns say Serialnum, IMEI, ESN, and NEI. I want to get the value of Serailnum field from a textbox and values for other 3 fields from a table.

Something like this:-

Add_button_clicked( )
{

Datagrid1.DataSource= Textbox1.Text;
Datagrid1.Databind();

SqlDataAdapter da = new SqlDataAdapter();
Dataset ds = new Dataset();
da.fill(ds, “table1”);
Datagrid1.Datasource = ds;
Datagrid1.Databind();
}


So if some one enters a Serialnum value in to the textbox, and clicks add button. That value should be added to the 1st field and in the first row of the datagrid. And other 3 fields value should be obtained from table1. Like wise when they enter 2nd value in the text box, it must be added to 1st filed and 2nd row of the datagrid, and other filed values should come from table1 and soon.

The textbox and button control’s are placed outside the grid i.e they are not part of the grid.

Output of This code:-
Datagrid1.DataSource= Textbox1.Text;
Datagrid1.Databind();

If some one enters say 2006 as serialnum in the text box and clicks add button. Then instead of adding 2006 in the 1st field of 1st row. It’s creating 4 rows and adding 2,0,0 and 6 to 1st field of each of the 4 row’s.


Can some one please explain me how we can attach multiple sources to a datagrid control.A textbox and table1. And how can we get the desired output in case of this:-
Output of This code:-
Datagrid1.DataSource= Textbox1.Text;
Datagrid1.Databind();

Thanks,