By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,537 Members | 2,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,537 IT Pros & Developers. It's quick & easy.

DataGridView Combobox Column Problem

P: 3
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
Share this Question
Share on Google+
1 Reply

P: 17
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.