1

我正在使用网格视图,其中包含一个下拉列表以及其他控件。我已成功绑定从数据库中选择的数据。但是,我想知道有没有办法让这个下拉为只读..请帮助..并且 ReadOnly="True" 不起作用

4

1 回答 1

1
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;
    }
}
于 2013-08-22T13:21:12.737 回答