Use Toolbar's DorpdownList in Web

xiaoxiao2021-03-17  208

Use Toolbar's DorpdownList in Web

code show as below:

1. Define a ToolbardropDownList type data DD in the first method and define an event dd.selectedIndexchanged.

2. Write the contents of the DD.selectedIndexchanged event in the second method.

3. Bind data to custom ToolbardropDownList

private void Page_Load (object sender, System.EventArgs e) {ToolbarDropDownList dd = ((ToolbarDropDownList) Toolbar1.Items [1]); dd.SelectedIndexChanged = new EventHandler (dd_SelectedIndexChanged);} private void dd_SelectedIndexChanged (object sender, System.EventArgs e ) {ToolbarDropDownList ds = new ToolbarDropDownList (); ds = (ToolbarDropDownList) sender;} private bind (Toolbar tb) {((ToolbarDropDownList) Toolbar1.Items [1]) DataSource = ds;. ((ToolbarDropDownList) Toolbar1.Items [1 .]) DataMember = "dd"; ((ToolbarDropDownList) Toolbar1.Items [1]) DataTextField = "name";. ((ToolbarDropDownList) Toolbar1.Items [1]) DataValueField = "bh";. ((ToolbarDropDownList) Toolbar1 .Items [1]). Database ();

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

New Post(0)