在UltraWebGrid单元格中绑定dropdownlist

    protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
    {
        SqlConnection con = new SqlConnection(AccessBase.connStr);
        SqlDataAdapter da = new SqlDataAdapter("select * from dbo.FeedBackType", con);
        DataSet ds = new DataSet();
        da.Fill(ds);
        Infragistics.WebUI.UltraWebGrid.UltraGridColumn col = this.UltraWebGrid1.Columns.FromKey("MessageType");
        //col.CellStyle.BackColor = Color.LightCyan;
        col.AllowUpdate = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes;
        col.Type = Infragistics.WebUI.UltraWebGrid.ColumnType.DropDownList;
        Infragistics.WebUI.UltraWebGrid.ValueList vl = new Infragistics.WebUI.UltraWebGrid.ValueList();
        vl.DataSource = ds;
        vl.DisplayMember = "MessageType";
        vl.ValueMember = "MessageType";
        vl.DataBind();
        col.ValueList = vl;
    }

你可能感兴趣的:(在UltraWebGrid单元格中绑定dropdownlist)