Presentation is loading. Please wait.

Presentation is loading. Please wait.

Things like Textboxes, Lables, ‘n’at. ASPX page is not HTML Controls are rendered into markup that a browser can understand Some controls are rendered.

Similar presentations


Presentation on theme: "Things like Textboxes, Lables, ‘n’at. ASPX page is not HTML Controls are rendered into markup that a browser can understand Some controls are rendered."— Presentation transcript:

1 Things like Textboxes, Lables, ‘n’at

2 ASPX page is not HTML Controls are rendered into markup that a browser can understand Some controls are rendered as HTML Some controls are rendered as javascript Some controls don’t render at all

3 A Simple Control Important Notes: Runat=“server” Required if you want to be rendered as a server control instead of regular HTML ID=“Label1” Required if you want to access this control from the code- behind.

4 How Does it Render? Awesome Label In this case, the control renders as less code than there was in the ASPX page not the case with all controls Will render differently based on the HTTP context (different browsers, HTTP versions, mobile support, etc.)

5 Name Mangling ASP.NET ID’s are not guaranteed to stay the same when a page is rendered ASP.NET “mangles” the name to make it unique on a page.

6 Name Mangling If The Page is placed inside a master page [EPIC FORSHADOWING]: Awesome Label Controls are named with the name of its containing control.

7 Name Mangling Id’s are different on the client side compared to the server side This is important to know if you are using *any* client side code. Use the Control.ClientID to access this name from the server side

8 Textboxes Similar to Label control Can use this control to get input from the user

9 Textboxes Textboxes render as. The “text” field is rendered as “value”

10 DropDownList

11 DropDownList Option 1 Option 2

12 CheckBoxList

13 CheckBoxList Option 1 Option 2

14 CheckBoxList Note this: This lets you click on the name of the checkbox and still “check” the box Many server controls are rendered with tables This makes the display more consistent across browsers* This is so ASP.NET doesn’t have to make assumptions about any CSS styling your page uses

15 User Controls Used to group multiple controls and treat them as a single control Can be used more than once on a page, and on multiple pages

16 A Simple User Control

17 A Simple User Control

18 Using a User Control in a page

19 Master Pages Common layout for a group of pages The old way: User control placed at the top of every page The new way: A page inside a page Inside a page INSIDE YOUR DREAM!

20 Creating a Master Page

21 Important Notes ContentPlaceHolder This is where child pages are rendered You need at least one of these if you want child content to render If you define a content placeholder, child pages need to use them

22 Using a Master Page <asp:Label ID="Label1" runat="server" Text="Awesome Label“

23 Accessing the master page On the Designer page: And in the Code Behind: string x = Master.CustomProperty;


Download ppt "Things like Textboxes, Lables, ‘n’at. ASPX page is not HTML Controls are rendered into markup that a browser can understand Some controls are rendered."

Similar presentations


Ads by Google