Gridview row editing - dynamic binding to a DropDownList

后端 未结 6 1619
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 01:33

I\'m trying to get an ASP.NET 3.5 GridView to show a selected value as string when being displayed, and to show a DropDownList to allow me to pick a value from a given list

6条回答
  •  不思量自难忘°
    2020-12-03 01:49

    protected void grvSecondaryLocations_RowEditing(object sender, GridViewEditEventArgs e)  
    {  
        grvSecondaryLocations.EditIndex = e.NewEditIndex;  
    
        DropDownList ddlPbx = (DropDownList)(grvSecondaryLocations.Rows[grvSecondaryLocations.EditIndex].FindControl("ddlPBXTypeNS"));
        if (ddlPbx != null)  
        {  
            ddlPbx.DataSource = _pbxTypes;  
            ddlPbx.DataBind();  
        }  
    
        .... (more stuff)  
    }
    

提交回复
热议问题