The WebDataInput controls can be used as editors for columns within the WebGrid, the EditorControlID property has been added to the column object. This property should be assigned the UniqueID of the control you wish to use an editor. In the following code, you will see that the ValueList.WebCombo property is no longer used and the EditorControlID should be utilized. The code below is placed within the Page_Load event and outlines all of the necessary steps for using a bound WebCombo as an editor for a column within a bound WebGrid. The Products and Categories table of the Northwind database serve as the respective datatables.
if (! this.IsPostBack)
{ //fill the adapters
this.oleDbDataAdapter1.Fill(this.dataSet11, this.dataSet11.Products.TableName);
this.oleDbDataAdapter2.Fill(this.dataSet11,this.dataSet11.Categories.TableName);
//set the datasource of the grid and databind
this.UltraWebGrid1.DataSource = this.dataSet11.Products;
this.UltraWebGrid1.DataBind();
//set the datasource and text and value fields of the combo... databind
this.WebCombo1.DataSource = this.dataSet11.Categories;
this.WebCombo1.DataTextField = this.dataSet11.Categories.CategoryNameColumn.ColumnName;
this.WebCombo1.DataValueField = this.dataSet11.Categories.CategoryIDColumn.ColumnName;
this.WebCombo1.DataBind();
//make sure the grid allows for editing
this.UltraWebGrid1.DisplayLayout.AllowUpdateDefault = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes;
//assign the webcombo as an editor for the CategoryID column in the grid
this.UltraWebGrid1.DisplayLayout.Bands[0].Columns.FromKey("CategoryID").Type = Infragistics.WebUI.UltraWebGrid.ColumnType.DropDownList;
this.UltraWebGrid1.DisplayLayout.Bands[0].Columns.FromKey("CategoryID").EditorControlID = this.WebCombo1.UniqueID;
}
Wednesday, December 3, 2008
use the WebCombo as a column editor in WebGrid
Posted by Suryan at 11:22 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment