Controls

1,851 views

Published on

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,851
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Controls

  1. 1. <ul><li>Introducing Asp.net Controls </li></ul><ul><li>by Rama Krishnam Raju </li></ul>
  2. 2. <ul><li>ASP.NET is the next generation ASP, but it's not an upgraded version of ASP. ASP.NET is an entirely new technology for server-side scripting. </li></ul><ul><li>Server controls are tags that are understood by the server. </li></ul><ul><li>ASP.NET contains a large set of HTML controls. Almost all HTML elements on a page can be defined as ASP.NET control objects that can be controlled by scripts. </li></ul>
  3. 3. <ul><li>Event Aware Controls ? </li></ul><ul><ul><li>All ASP.NET objects on a Web page can expose events that can be processed by ASP.NET code. </li></ul></ul><ul><ul><li>Load, Click and Change events handled by code makes coding much simpler and much better organized. </li></ul></ul><ul><li>Limitations in Classic ASP ? </li></ul><ul><ul><li><html> <body bgcolor=&quot;yellow&quot;> <center> <h2>Hello W3Schools!</h2> <p><%Response. Write(now())%></p> </center> </body> </html> </li></ul></ul>
  4. 4. Introducing Web Controls <ul><li>ASP.NET - Server Controls ? </li></ul><ul><ul><li>Server controls are tags that are understood by the server. </li></ul></ul><ul><ul><li>There are three kinds of server controls: </li></ul></ul><ul><ul><ul><li>HTML Server Controls - Traditional HTML tags </li></ul></ul></ul><ul><ul><ul><li>Web Server Controls - New ASP.NET tags </li></ul></ul></ul><ul><ul><ul><li>Validation Server Controls - For input validation </li></ul></ul></ul><ul><li>ASP.NET - Web Server Controls ? </li></ul><ul><ul><li>Like HTML server controls, Web server controls are also created on the server and they require a runat=&quot;server&quot; attribute to work. However, Web server controls do not necessarily map to any existing HTML elements and they may represent more complex elements. </li></ul></ul>
  5. 5. Introducing Web Controls <ul><li>ASP.NET - Validation Server Controls? </li></ul><ul><li>Validation server controls are used to validate user-input. If the user-input does not pass validation, it will display an error message to the user. </li></ul><ul><li>Each validation control performs a specific type of validation (like validating against a specific value or a range of values). </li></ul><ul><li>By default, page validation is performed when a Button, ImageButton, or LinkButton control is clicked. You can prevent validation when a button control is clicked by setting the CausesValidation property to false. </li></ul>
  6. 6. Introducing Web Controls <ul><li>The TextBox Control? </li></ul><ul><li>The TextBox control is used to create a text box where the user can input text. </li></ul><ul><li>The example below demonstrates some of the attributes you may use with the TextBox control. </li></ul><ul><li>By default, page validation is performed when a Button, ImageButton, or LinkButton control is clicked. You can prevent validation when a button control is clicked by setting the CausesValidation property to false. </li></ul>
  7. 7. Introducing Web Controls <ul><li><html> </li></ul><ul><li><body> </li></ul><ul><li><form runat=&quot;server“> </li></ul><ul><li>A basic TextBox: </li></ul><ul><li><asp:TextBox id=&quot;tb1&quot; runat=&quot;server&quot; /> </li></ul><ul><li><br /><br /> </li></ul><ul><li>A password TextBox: </li></ul><ul><li><asp:TextBox id=&quot;tb2&quot; TextMode=&quot;password&quot; runat=&quot;server&quot; /> </li></ul><ul><li><br /><br /> </li></ul><ul><li>A multiline TextBox: </li></ul><ul><li><asp:TextBox id=&quot;tb3&quot; TextMode=&quot;multiline&quot; runat=&quot;server&quot; /> </li></ul><ul><li><br /><br /> </li></ul><ul><li></form> </li></ul><ul><li></body> </li></ul><ul><li></html> </li></ul>
  8. 8. Introducing Web Controls <ul><li>The Button Control? </li></ul><ul><li>The Button control is used to display a push button. The push button may be a submit button or a command button. By default, this control is a submit button. </li></ul><ul><li>A submit button does not have a command name and it posts the page back to the server when it is clicked. It is possible to write an event handler to control the actions performed when the submit button is clicked. </li></ul><ul><li><html> <body> <form runat=&quot;server&quot;> <asp:Button id=&quot;b1&quot; Text=&quot;Submit&quot; runat=&quot;server&quot; /> </form> </body> </html> </li></ul>
  9. 9. Introducing Web Controls <ul><li>The DropDownList Control? </li></ul><ul><li>The DropDownList control is used to create a drop-down list. </li></ul><ul><li>Each selectable item in a DropDownList control is defined by a ListItem element!. </li></ul><ul><li> Tip: This control supports data binding! </li></ul><ul><li>Syntax to Declare a Dropdownlist </li></ul><ul><li><asp:dropdownlist id=&quot;list1&quot; runat=&quot;server&quot;> </li></ul><ul><ul><li><asp:listitem>Male</asp:listitem > </li></ul></ul><ul><ul><li><asp:listitem >Female</asp:listitem > </li></ul></ul><ul><li></asp:dropdownlist > </li></ul>
  10. 10. Introducing Web Controls <ul><li>The Checkbox Control? </li></ul><ul><li>The Checkbox control is used to create a Checkbox. </li></ul><ul><li>Syntax to Declare a Dropdownlist </li></ul><ul><li><asp: Checkbox id=&quot;chkID“ runat=&quot;server“ text=“Check1” </li></ul><ul><li>OnCheckedChanged=“chkID_CheckedChanged”> </li></ul><ul><li></asp: Checkbox> </li></ul>Property Description Id Id of the Checkbox runat Specifies that the control is a server control text The text to the check box OnCheckedChanged function to be executed when the Checked property has changed
  11. 11. Introducing Web Controls <ul><li>Web Server Controls? </li></ul><ul><li>Web server controls are special ASP.NET tags understood by the server. </li></ul><ul><li>Like HTML server controls, Web server controls are also created on the server and they require a runat=&quot;server&quot; attribute to work. However, Web server controls do not necessarily map to any existing HTML elements and they may represent more complex elements. </li></ul><ul><li>The syntax for creating a Web server control is: </li></ul><ul><li> <asp:control_name id=&quot;some_id&quot; runat=&quot;server&quot; /> </li></ul>
  12. 12. Introducing Web Controls Web Server Control Description Button Displays Push Button Calendar Displays a calendar CheckBox Displays a check box DataGrid Displays fields of a data source in a grid DropDownList Creates a drop-down list Label Displays static content which is programmable (lets you apply styles to its content) RadioButton Creates Radio Button TextBox Creates an input field
  13. 13. <ul><li>Thank You ! </li></ul>

×