WebGrid use: (2), dynamic adding Webcombo to WebGrid

xiaoxiao2021-03-06  85

Dynamically add actions on Webcombo to WebGrid:

1. Add a Webcombo to the page in the page.

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 = "support"; page.FindControl ("form1"). Controls.Add (WC); 2, add the column specified by WebGrid as 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, specified resources for Webcombo

Private void wcsupplier_initdata (Object sender, isnet.Webui.Webcombo.datasourceEventArgs e) {E.DataSource = getsupplierlist ();}

DataTable getsupplierlist () {dataable dt = new data ("suppliers"); OLEDBDataAdapter Da = New OLEDBDataAdapter ("Select * from support), OLEDBConnection1); da.fill (dt); Return Dt;}

转载请注明原文地址:https://www.9cbs.com/read-106343.html

New Post(0)