Professional ASP.NET 4.5 in C# and vb.net (1)

Chapter 1: One ASP.NET
Whatever project type you choose, it’s all based on ASP.NET. You can add any project to your solution later and it will still be supported.

image

For example, you want to build an app that is a single page app, and use Twitter/Facebook to log in. (VS 2013)
(1) Create a ASP.NET Web APP
image
(2) Select SPA
image
(3) In the solution, add a Web API
image
(To test your Web API, use WebApiTestClient – download it from Nuget.)
(4) SignalR – Relatime functionality.

Chapter 2: HTML 5 and CSS3 Design with ASP.NET
HTML5 –
input type: tel, search, url, email, datetime, date, month, week, time, datetime-local, number, range, color

Example 1:
image

In google crome, you will see:
image
(Not working in IE because it’s not implemented in IE yet)
Example 2:
image
IE and Chrome implemented it differently.
image

CSS Selector
Applies to <p> tag
image
Applies to all tags
image
Descendent Selector
does not have to be direct descendant
image
has to be direct descendant
image 
Attribute Selector
Applies to any element that has the href attribute
image
Advanced:
For each link that starts with https, add an image
image
Class Selector (using DOT)
image
ID Selector (using #)
image
Others:
image
image

Pseudo-Element:
First line or letter of each paragraph
image
Insert content before and after the tag.
image
selector Grouping
image
Page 35

Modernizr.js is inclided in all VS templates to achieve compatibility with older browsers. With better HTML5 support, use HTML5Shiv.js, also known as HTML5 shim file.
Chapter 3: Asp.net Web Forms Structure
Import your namespace so it can be referenced on each page without the full name
image
Under app_code, it is possible to use classes created using C# and VB – need to create a VB and CS folder, such as:
image
and also update web.config file:
image
Resource files – data dictionary and language files.
*** new: Rename your HTML or TEXT file to *.aspx and they will be compiled into APP_WEB_XXXX.dll like other ASP.NET files!!!
Right click a class (in class diagram/designer), and select Refactor –> Extract Interface to extract the interface.
image

You get an Interface file.
image
You can add or edit class members here:
image
After you add a new method:
image

Chapter 4: Server side controls and client-side controls
HTML Server Controls
image
Top is the regular button server control; button is the HTML button control (with runat=”server”). make sure to add an ID attribute to HTML server controls.
image
Define the javascript string in code behind, and then execute the javascript on postback
image
***
Page.ClientScript.RegisterClientScriptBlock – javascript placed on top
Page.ClientScript.RegisterStartupScript – javascript placed at bottom
Page.ClientScript.RegisterStartupScriptInclude – include an external javascript file
***
Page 122

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s