These controls are the independent controls and they will not extend other controls. The webserver controls available in AJAXcontrolToolkit are as follows.
Accordion control is used to provide a number of panes on the page allow the user to expand a panel by clicking on its header when user select a pane then all other panes available in the accordion control will be automatically collapsed.
Use the property panes to create panes within the accordion control & for every pane you have to specify header& content where header is used to specify heading for that & content is used to specify the context to display within that pane.
The following example demonstrates how to use the accordion.
<style type=”text/css”> .header { background-color:Black; font-family : Arial Black; font-size : large; color:white; } .selected header { background-color:Blue : font-family:Arial Black: font-size :large; color : white ; }
<asp: Accordion ID=”Accordion1” runat=”server” FadeTransitions=”true” Headercssclass=”header” Framepersecond=”30” TransitionDuration=”2000” Headerselectedcssclass=”selectedheader” requireiopenedpane=”true”> <panes> <asp:Accordionpane Id=”AP1” runat=”server”> <Header> This is Accordion Panel </Header> <context> This is according panel context <br/> This is Accordion panel context <br/> ------------------ ------ </context> </asp:Accordionpane> <asp:Accordiopane Id=”AP2” runat=”server”> <Header> This is Accordion pane 2 </Header> <context> This is Accordion pane 2 context <br/> This is Accordion pane 2 context <br/> ---- ------------------- </context> </asp:Accordionpane> </panes> </asp:Accordion>
Asyncfileupload control is used to Asynchronously upload the file to server properties.
saveAS() : Used to save the file selected in the Asynfileupload to the server.
The following example demonstrates how to use the AsyncFileupload.
Button click { if(AFUL.Hasfile) { string path=”~/photos/” + AFUL.fileName; AFUL.saveAs(Mappath(path)); Image1.Imageurl.path l }}
AJAX file upload is also used to upload files to the server.Advantage of this over Asyncfileuploader & fileupload of control of ASP.net is you can select multiple files at a time with a Ajaxfileupload and displays the progress of uploading a file by clicking on the AJAX file upload you can select multiple files by holding control (ctrl) or shift key. You can also select multiple file by simple dragging & dropping the files on to the AJAX – fileupload control.
SaveAs () : Used to save the file selected in Ajaxfileupload to the server. within the browsers like Internet explorer chrome its that support HTML5 & CSS 3 this control can automatically display the progress of uploading a file with a progress bar when if takes time to upload.
This control is used with dropdown list control and it is used to automatically get values to display in a dropdown list by executing a method Asynchronously.
The following example demonstrates how to use the cascading dropdown with dropdownlist controls.
<asp : cascading Dropdown ID=”cascading Drop Down1” runat=”server” TargetcontrolID = “DDL1” category=”countries” LoadingText=”[Loading countries]” promptText = “select your country” Servidemethod=”Getcountries” usecontentkey = “True”> </asp: cascadingDropDown> <asp : Cascading Dropdown ID=”cascading Dropdown2” runat=”server” TargetcontrolID=”DDL2” parentcontrolID=”DDL1” category=”states” LoadingText = “[loading states]” propmptText = “select your state” usecontextkey=”True”> </asp:cascadingDropDown> Within the design of the page click on the smart tag of 1st dropdown list & choose “Add cascading Drop down page method” to create a Method in the code getcounties which is set as the serviceMethods for the 1 st cascading Dropdown & write the following code with in it.{ sqlconnection cn= new sqlconnection (“server=Nikhil; database=mydb;uid=sa;pwd=123”); Sqldatadpater Da=new Sql DataAdapter(“Select country from countires”, cn); Dataset Ds= new Dataset(); Da.fill(Ds,”countries”); CascadingDropDownNameValue[]Items=new cascading DropDownNamevalue[d.Tables[“countries”].Rows.count]; int i=0; foreach(DataRow Dr in Ds.Tables[“Countries”].Rows) { Items[i++]=new cascadingDropDownNameValue(Dr[0].Tostring(),Dr[0].Tostring()); } returns Items; }
{ string country=knowncategoryvalues; country=country.substring(country.Indexof(“:”)+1); country=country.substring(0,country.Length-1); Sqlconnection cn=new sqlconnection(“Server=Nikhil; database=mydb;uid=sa;pwd=123); SqldataAdapter Da=new sqlDataAdapter( “Select state from states from states where country=”’+country+’”,cn); Dataset Ds = new Dataset(); Da.fill(Ds.”States”); CascadingDropDownNameValue[]Items=new CascadingDropDownNameValue[DS.Table[“states”].Rows.count]; int i=0; foreach(DataRow Dr in Ds.Tables[“states”].Rows) { Item[i++]=new cascading DropDownNameValue( Dr[0].Tostring()); } returns Items; }
create table countries(country varchar(30)) create table states (country varchar(30),state varchar(30))
Combo Box is similar to DropDownList except that it allows you to select an Item from the List and also type the Item If it is not available in List.
The default event for combobox is selected Indexchanged.
You liked the article?
Like : 0
Vote for difficulty
Current difficulty (Avg): Medium
1/15
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.
Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox