Click here to Skip to main content
15,896,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a GridView in which I have columns like MachineCode, MachineName and OperationName were OperationName is DropdownList.
User want to select Operations for that perticular machine. For every machines operations can be different. I want to bind every Dropdownlist in each row with diferent datasource. how to do this in c#?
Posted
Updated 21-Aug-14 1:00am
v2

 
Share this answer
 
You can bind the datasource to dropdownlist in GridView's RowDataBound Event

C#
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
DropDownList ddl = (DropDownList)e.Row.FindControl("DropDownList1");
ddl.DataSource = your_data_set;
ddl.DataBind(); 

}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900