470,863 Members | 1,214 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,863 developers. It's quick & easy.

DataGridView Combobox Column Problem

At this moment my problem is how to make suplier combobox has different list in every row. I want suplier lists that related with a certain product instead of providing all the supliers.
Let say "product A" only has "Suplier B", "Suplier D" and "Suplier E",
"Product B" only has "Suplier A", "Suplier C", and
"Product C" only has "Suplier B", "Suplier D".
I can provide store procedure for this, but I don't know how to put this different datas in datagridviewcomboboxcolumn.

Sep 22 '08 #1
1 1583
I think you can use item template to show combobox in grid. in rowbound event of grid find that combobox control of each row and call sp or query collect the values for combobox and bind that combobox with DataTextField & DataValueField.

May be you can use procedure as given below

protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)

if (e.Row.RowType == DataControlRowType.DataRow)

DropdownList ddl= ((DropdownList )e.Row.FindControl("controlname"));
//Here you can write actual code
//Call sql query to retrive dropdown values individually
//Bind that ds/dt column values to ddl

ddl.DataTextField = " Column1";
ddl.DataValueField = "column2";
ddl.datasource = ds/dt;

Sep 22 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Art | last post: by
8 posts views Thread by Brian Pelton | last post: by
4 posts views Thread by =?Utf-8?B?Q2hyaXM=?= | last post: by
3 posts views Thread by =?Utf-8?B?Sm9obiBCdW5keQ==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.