GridView中一的项默认显示是一个数值,当我点后面的修改的时候,  原来显示的那项变成下拉菜单
这种功能如何实现

解决方案 »

  1.   

    用模板列,itemtemplate里放一个label,即默认时显示方式;edititemtemplate里放dropdownlist,即点修改后的显示方式
      

  2.   

    前台如楼上所说,设定一个模板列,在<ItemTemplate>里放一个Label,做为默认显示方式;
    在<EditItemTemplate>里放一个DropDownList,做为点击修改后显示方式。。后台的话:
    在Row_DataBound事件里:    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (((DropDownList)e.Row.FindControl("DDLAddress")) != null)
            {
                DropDownList ddlAddress = (DropDownList)e.Row.FindControl("DDLAddress");
                DataSet ds = Common.dataSet("select Address from Address");
                ddlAddress.DataSource = ds.Tables[0].DefaultView;
                ddlAddress.DataTextField = "Address";
                ddlAddress.DataValueField = "Address";
                ddlAddress.DataBind();
             }
          }
      

  3.   

    全部都不行,就是取不到<EditItemTemplate>中的东西