动态的添加webcombo到webgrid上的操作:

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;
 }