Radcontrols controls of telerik (III)

Source: Internet
Author: User

I believe you have learned from radcontrolRadwindow, radajaxmanager, and radajaxloadingpanelAfter the control, it will certainly feel that it is a technical tool for the liberation of. Net technical personnel web development, so that it is no longer ASP. Net.

Now I tell you that the front is just the first step for you to find web development easier and more convenient. By introducing other commonly used rad controls in the project, you will be more ecstatic. Now I will introduce another heavy-weight control telerik.The radcombobox drop-down list control.

RadcomboboxThe control is used for ASP. NET applications.ProgramAnd can create controls for the flexible drop-down interface. This product has a series of rich features, such as Asynchronous callbacks, auto-complete, automatic sorting, verification, stacked display, and custom appearance.

Its advantages include:

1. Powerful Auto-complete functions;

2. Load as needed;
3. Supports the template function;

4. Flexible binding mechanism;

5. Rich server and client events;

6. associate multiple combos
You can set multiple r.a.d. ComboBox control instances on the same page, and easily associate them through client or server events.

Instance analysis:

1. Operation Diagram

2. Control htmlCode:

<Telerik: Radcombobox Id = "radcomborole" runat = "server" highlighttemplateditems = "true" autopostback = "true"
Allowcustomtext = "true" onclientdropdownclosed = "ondropdownclosing"
Width = "96%" onselectedindexchanged = "radcomborole_selectedindexchanged">
< Itemtemplate >
<Div onclick = "stoppropagation (event)" class = "combo-item-template">
<Asp: checkbox runat = "server" id = "CHK1" onclick = "oncheckboxclick (this)"/>
<Asp: Label runat = "server" id = "label1" associatedcontrolid = "CHK1">
<% # Eval ("rolename") %>
</ASP: Label>
</Div>
</ Itemtemplate >
</Telerik: Radcombobox >

3. Auxiliary JS scripts:

<SCRIPT type = "text/JavaScript" Language = "JavaScript">
VaR canceldropdownclosing = false;
FunctionOndropdownclosing(){
Canceldropdownclosing = false;
}

Function Stoppropagation (E ){
E. cancelbubble = true;
If (E. stoppropagation ){
E. stoppropagation ();
}
}
Function Oncheckboxclick (Chk ){
VaR combo = $ find ("<% = radcomborole. clientid %> ");
Canceldropdownclosing = true;
VaR text = "";
VaR values = "";
VaR items = combo. get_items ();
For (VAR I = 0; I <items. get_count (); I ++ ){
VaR item = items. getitem (I );
VaR CHK1 = $ get (combo. get_id () + "_ I" + I + "_ CHK1 ");
If (chk1.checked ){
Text + = item. get_text () + ",";
Values + = item. get_value () + ",";
}
}
TEXT = removelastcomma (text );
Values = removelastcomma (values );

Combo. set_text (text );
Combo. set_value (values );
}
Function removelastcomma (STR ){
Return Str. Replace (/, $ /,"");
}

4. Background code:

Private void bindcomboxlist ()
{
List <sysrole> sysrolelist = sysrolelogic. getsysrolelist ();
Radcomborole. datasource = sysrolelist;
Radcomborole. datatextfield = "rolename ";
Radcomborole. datavaluefield = "roleid ";
Radcomborole. databind ();
}

In the preceding four steps, you can set the effects that can be achieved only by doing many things in the past. In addition, this control can achieve tree selection, for example:

The HTML code is as follows:

<Telerik: Radcombobox Id = "radcombox2" width = "240px" Height = "300px" allowcustomtext = "true"
Emptymessage = "showing all cars" onclientdropdownclosing = "onclientdropdownclosinghandler"
Runat = "server">
<Itemtemplate>
<Div onclick = "stoppropagation (event)">
<Telerik: Radtreeview Id = "radtreeview1" runat = "server" performanceid = "sqlperformance2"
Datatextfield = "vehiclename" datavaluefield = "vehicletypeid" datafieldid = "ID" datafieldparentid = "vehicleparentid"
Onclientnodeclicking = "onclientnodeclickinghandler">
<Databindings>
<Telerik: radtreenodebinding depth = "0" Category = "make" imageurlfield = "ImagePath"/>
</Databindings>
</Telerik: Radtreeview >
</Div>
</Itemtemplate>
<Items>
<Telerik: radcomboboxitem/>
</Items>
</Telerik:Radcombobox >

The specific operation process is not much said, please refer to the http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/templates/defaultcs.aspx

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.