Bind data from the background to the comboBox drop-down box component of ligerui.
This time, we will record the comboBox drop-down box component of ligerUI. The ligerUI API also contains related descriptions, which are all dead data written on the front end and then displayed in the component, what I want to talk about this time is to bind the background data to the drop-down box component.
First of all, we need to reference ligerComboBox. js of ligerUI.
Function showComboBox (xmlListXml) {// focuses on the data set queried in the background. // you can obtain the background set through ajax or Parse xml, // rs is the set that I get from the background. // Let's not talk about it. Let's see how to bind the data obtained in the background to var rs = xmlListXml in comboBox. getElementsByTagName ("r"); var array = new Array (); for (var I = 0; I <rs. length; I ++) {var option ={}; // id and text correspond to the id and value of the list items in the drop-down box. // The value can be the same and can be selected as needed. id = rs [I]. childNodes [1]. firstChild. data; option. text = rs [I]. childNodes [1]. firstChild. data; array. push (option) ;}$ ("# cmb "). ligerComboBox ({data: array, onSelected: function (newValue) {alert (newValue) ;}, emptyText: '<all event types>', isMultiSelect: false, highLight: true, width: 280 });}
In this way, you can bind the background data to the comboBox. If you don't even know how to obtain the background data, I won't say much...
In this way, you can bind the background data to the comboBox. If you don't even know how to obtain the background data, I won't say much about it...
In this way, you can bind the background data to the comboBox. If you don't even know how to obtain the background data, I won't say much about it...
In this way, you can bind the background data to the comboBox. If you don't even know how to obtain the background data, I won't say much about it...
In this way, you can bind the background data to the comboBox. If you don't even know how to obtain the background data, I won't say much about it...
How to bind a tree control to data in ligerui
Hello, ligerui, jqurey UI. I have used it and it feels very powerful. The data bound to the tree control can be directly assigned as long as you convert the data obtained from the background to the form of a key-value pair. It will be automatically bound. There are also many grid controls in it. If you still do not understand, add: QQ1534968714. Let's discuss it together.
How to bind a column name to a database in the drop-down list?
Winform comboBox data binding method
// C #
Private void BindComboBox ()
{
ComboBox1.DataSource = dataSet1.Tables ["Suppliers"];
ComboBox1.DisplayMember = "data table column name ";
ComboBox1.valueMember = "column name value ";
}
// VB
Private Sub BindComboBox ()
ComboBox1.DataSource = DataSet1.Tables ("Suppliers ")
ComboBox1.DisplayMember = "data table column name"
ComboBox1.DisplayMember = "column name value"
End Sub
Webform DropDownList binding method:
Private void BindDropDownList1 ()
{
DataTable dt = dataSet1.Tables ["Suppliers"];
This. DropDownList1.DataSource = dt;
This. DropDownList1.DataTextField = "name ";
This. DropDownList1.DataValueField = "fid ";
This. DropDownList1.DataBind ();
}