DevExpress2011 Control Tutorial) example of an edit control (Combobox,aspxcheckbox) 1

Source: Internet
Author: User

DevExpress2011 Control Tutorial) example of an edit control (Combobox,aspxcheckbox) 1

Aspxcheckbox is a check edit control to show whether special conditions are closed or open. It usually shows yes/no or true/false choices to the user. The user can change the check state by clicking on the edit control with the mouse or by pressing the space key.

Version 2011 allows 2 or 3 states. The Aspxcheckbox supports 2 to 3 state, depending on the Allowgrayed property setting. Use the program to set the state, generally using the checked or CheckState property. Checked is a logical variable that can identify only Checked and unchecked states. The CheckState property allows you to select three states, namely indeterminate ,Checked ,unchecked. the precondition is that the Allowgrayed property is set to True.

in three state modes, you can increase the Allowgrayedbyclick property to control whether the user is converting whether the edit control allows Indeterminatez state.

< DX : Aspxcheckbox ID = "ASPxCheckBox1" runat = "Server" allowgrayed = "True"

Text = "Check" >

</ DX : Aspxcheckbox >

Allowgrayedbyclick to True in the CheckBox property page

CheckBox control to customize picture display status

You can use the Properties page in the

Images-> Checkedimage->url

Images-> Grayedimage->url

Images-> Uncheckedimage->url

Set Personalized picture effects

Combo Box

Data binding

1. SqlDataSource set up a data connection, as described in the previous article setting methods

2. ComboBox the Choose Data Source is SqlDataSource1

3. data –>textfield in property pages, Valuefield settings need to display columns and values

< DX : Aspxcombobox ID = "ASPxComboBox1" runat = "Server"

DataSourceID = "SqlDataSource1" DropDownStyle = "DropDown" TextField = "GroupName"

Valuefield = "GroupID" ValueType = "System.String" >

</ DX : Aspxcombobox >

4. The result of running the program is as follows:

The combobox control has a front-end filtering function,

Property Page Behavior->incrementalfilteringmode property

Startswidth: edit a control to filter items in a list to find characters that begin with a filter condition

Contains: The edit control filters the items in the list to find the characters that contain the filter criteria

None: No filter conditions required

<Dx:aspxcomboboxID= "ASPxComboBox1"runat= "Server"
DataSourceID= "SqlDataSource1"DropDownStyle= "DropDown"
Incrementalfilteringmode= "Contains"TextField= "GroupName"Valuefield= "GroupID"
ValueType= "System.String">
</Dx:aspxcombobox>

ComboBox Multi-column drop-down display

The Aspxcombobox control allows their list data to be displayed in multiple columns.

Click the combobox control to set their display columns

Run the program, visible to the drop-down column is a multi-column display, but the obtained TextBox display value is 27; Manage,

In order to show good looks, we can set textformatstring= "{0}" so that the display value is only the first in the array.

ComboBox Picture in edit area

By default, the Edit dropdown list mode allows you to associate with a picture.

1. Manually add tems mode, we can connect the pictures you need on the miscellaneous –> IMAGEURL of each items

2. Data binding method. The Imageurlfield property of the edit control allows you to display the URLs field of the picture.

<dx:aspxcombobox id= "ASPxComboBox1" runat= "Server" datasourceid= "XmlDataSource1"
imageurlfield= "ImageUrl" textfield= "Text" valuefield= "Name" valuetype= "System.String"
showimageineditbox= "True" selectedindex= "0" >
<itemimage height= "24px" width= "23px"/>

ComboBox Linkage Effect

1. Bind the first ComboBox

Using SqlDataSource

< DX : Aspxcombobox ID = "Cmbboxfather" runat = "Server"

DataSourceID = "SqlDataSource1" TextField = "GroupName" Valuefield = "GroupID"

ValueType = "System.String" Clientinstancename = "Cmbboxfather" >

</ DX : Aspxcombobox >

2. Add the SelectedIndexChanged event for Client-side event in the ComboBox

< clientsideevents SelectedIndexChanged = "function (s, e) {

Cmbboxchild.performcallback ();

} " />

The above code is as follows:

< DX : Aspxcombobox ID = "Cmbboxfather" runat = "Server"

DataSourceID = "SqlDataSource1" TextField = "GroupName" Valuefield = "GroupID"

ValueType = "System.String" Clientinstancename = "Cmbboxfather" >

< clientsideevents SelectedIndexChanged = "function (s, e) {

Cmbboxchild.performcallback ();

} " />

</ DX : Aspxcombobox >

3. Add oncallback= "Cmbboxchild_callback" clientinstancename= "In the second ComboBox" Cmbboxchild "

< DX : Aspxcombobox ID = "Cmbboxchild" runat = "Server" I

OnCallback = "Cmbboxchild_callback" Clientinstancename = "Cmbboxchild" >

</ DX : Aspxcombobox >

4. Adding events in CS

protected void cmbboxchild_callback (object sender, DevExpress.Web.ASPxClasses. Callbackeventargsbase e)

{

string s=cmbboxfather.selecteditem.value.tostring ();

string SQL = "Select ID, GroupID, usertype, EmpID from ?? " Households ? ì Group á¨| where groupid= "+s;

DataSet ds = db. ExecuteDataset (System.Data. CommandType. Text, SQL);

Cmbboxchild.datasource =ds. Tables[0];

Cmbboxchild.textfield ="EmpID";

cmbboxchild.valuefield="EmpID";

Cmbboxchild.databind ();

}

Run results for example, after selecting the group name, the user ID of the group name is automatically displayed in the second ComboBox (in fact, this is the effect of our common Ajax linkage)


DevExpress2011 Control Tutorial) example of an edit control (Combobox,aspxcheckbox) 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.