UltraWebGrid列中如何添加WebCombo

UltraWebGrid列中如何添加WebCombo
----------------------------------------
1、在页面中用代码添加一个webcombo.
 ISNet.WebUI.WebCombo.WebCombo wc =new ISNet.WebUI.WebCombo.WebCombo("wcSupplier");
 wc.InitializeDataSource += new ISNet.WebUI.WebCombo.DataSourceEventHandler(wcSupplier_InitData);
 wc.DataTextField = "ContactName";
 wc.DataValueField = "SupplierID";
 Page.FindControl("form1").Controls.Add(wc);
 
2、给webgrid指定的列添加为webcombo
 private void WebGrid1_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
 {
  WebGrid1.RootTable.Columns.GetNamedItem("SupplierID").EditType = EditType.WebComboNET;
  WebGrid1.RootTable.Columns.GetNamedItem("SupplierID").WebComboID = "wcSupplier";
 
  WebValueList vl = WebGrid1.RootTable.Columns.GetNamedItem("SupplierID").ValueList;
  if (!vl.IsDataCached())
   vl.DataSource = GetSupplierList();
  vl.DataTextField = "ContactName";
  vl.DataValueField = "SupplierID";
 }
 
3、为webcombo指定资源
 private void wcSupplier_InitData(object sender, ISNet.WebUI.WebCombo.DataSourceEventArgs e)
 {
  e.DataSource = GetSupplierList();
 }
 DataTable GetSupplierList()
 {
  DataTable dt = new DataTable("Suppliers");
  OleDbDataAdapter da = new OleDbDataAdapter("select * from suppliers", oleDbConnection1);
  da.Fill(dt);
 
  return dt;
 }
 
方法2 UltraWebGrid列中如何添加WebCombo
-------------------------------------------
 
        UltraWebGrid1.Bands[0].Columns[13].EditorControlID = "WebDateChooser1";
        UltraWebGrid1.Bands[0].Columns[13].Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom;

你可能感兴趣的:(combo)