Reputation: 4753
I am using grid view which contains a drop down list inside it along with other controls. I am sucessfully binding the data selected from database. but, i want to know is there any way to make this drop down as read only.. Please help..and ReadOnly="True" is not working
Upvotes: 1
Views: 1254
Reputation: 4059
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow))
{
DataRow row = ((DataRowView)e.Row.DataItem).Row;
DropdownList ddlxxx= (DropDownList)e.Row.FindControl("ddlName");
//This will make your ddl readonly
ddlxxx.Enabled = false;
}
}
Upvotes: 1