Learning Curve…

Archive for the ‘Asp.net’ Category


ASP.NET 4.0 supports built in support for URL Routing. This can make site more user friendly and site content more discoverable by search engines. It is also easy to remember and while bookmarking.

Following example shows URL without using Routing mechanism of ASP.NET 4.0.


After using Routing mechanism of ASP.NET 4.0, above URL becomes as follow.


For mapping above URL to the list of products based on category, we need to map our route using new method MapPageRoute of class Route as shown in following examples.
Application_Start(object sender, EventArgs e)   {
         “product/{prodId}”, “~/products.aspx”);


  1. Range variable: – A variable defined in your LINQ query that is subsequently used in the select and where parts.
  2. Strong typing: – A programming concept where the type of a variable is explicitly defined when the variable is declared.
  3. Type inference: – A technique where the compiler determines the type of a variable based on the data it gets assigned. This enables you to create strongly typed variables without explicitly defining the variable’s type first
  4. Lazy loading: – A technique where data is not loaded from the database until it is accessed at runtime.
  5. Anonymous types:-Types that are created on-the-fly without defining them explicitly.

Eval is one-way, read only databinding.

Bind is two-way, read/write databinding.

Factors User control Custom control
Deployment Designed for single-application scenarios

Deployed in the source form (.ascx) along with the source code of the application

If the same control needs to be used in more than one application, it introduces redundancy and maintenance problems

Designed so that it can be used by more than one application

Deployed either in the application’s Bin directory or in the global assembly cache

Distributed easily and without problems associated with redundancy and maintenance

Creation Creation is similar to the way Web Forms pages are created; well-suited for rapid application development (RAD) Writing involves lots of code because there is no designer support
Content A much better choice when you need static content within a fixed layout, for example, when you make headers and footers More suited for when an application requires dynamic content to be displayed; can be reused across an application, for example, for a data bound table control with dynamic rows
Design Writing doesn’t require much application designing because they are authored at design time and mostly contain static data Writing from scratch requires a good understanding of the control’s life cycle and the order in which events execute, which is normally taken care of in user controls
Compilation Compiled at runtime Precompiled
ToolBox Cannot be added to the ToolBox Can be added to the ToolBox (using drag and drop)

The new ClientIDMode property lets you specify more precisely how the client ID is generated for controls. You can set the ClientIDMode property for any control, including for the page. Possible settings are the following:
This is equivalent to the algorithm for generating ClientID property values that was used in earlier versions of ASP.NET.

This specifies that the ClientID value will be the same as the ID without concatenating the IDs of parent naming containers. This can be useful in Web user controls. Because a Web user control can be located on different pages and in different container controls, it can be difficult to write client script for controls that use the AutoID algorithm because you cannot predict what the ID values will be.

This option is primarily for use in data controls that use repeating templates. It concatenates the ID properties of the control’s naming containers, but generated ClientID values do not contain strings like “ctlxxx”. This setting works in conjunction with the ClientIDRowSuffix property of the control. You set the ClientIDRowSuffix property to the name of a data field, and the value of that field is used as the suffix for the generated ClientID value. Typically you would use the primary key of a data record as the ClientIDRowSuffix value.

This setting is the default behavior for controls; it specifies that a control’s ID generation is the same as its parent.

QueryExtender Control is an add-on to the DataSource Controls: EntityDataSource and LinqDataSource. QueryExtender is used to filter the data returned by these controls. As the QueryExtender control relies on LINQ, the filter is applied on the database server before the data is sent to the page, which results in very efficient operations.

"<asp:LinqDataSource ID="dataSource" runat="server"> TableName="Products"> "
" </asp:LinqDataSource> <asp:QueryExtender TargetControlID="dataSource" runat="server"> "
"<asp:SearchExpression DataFields="ProductName, Supplier.CompanyName" SearchType="StartsWith">  "
"<asp:ControlParameter ControlID="TextBoxSearch" />"
 "</asp:SearchExpression> </asp:QueryExtender> "

ASP.Net 4.0 has many improvements from previous versions such as

  • Web.config File Refactoring
  • Extensible Output Caching
  • Auto-Start Web Applications
  • Permanently Redirecting a Page by introducing a new method RedirectPermanent()
  • Shrinking Session State to shrink session data
  • Extensible Request Validation to avoid cross-site scripting (XSS) attacks by adding custom request-validation logic.
  • Object Caching and Object Caching Extensibility by introducing a new assembly “System.Runtime.Caching.dll”

ASP.Net 4.0 also introduced many new features such as

  • jQuery Included with Web Forms and MVC: Built in JQuery support
  • Content Delivery Network Support: Enables you to easily add ASP.NET Ajax and jQuery scripts to your Web applications. We can refence JQuery script over http like <script src=”http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js&#8221; >
  • New Meta tags under HTML Head tag
  • Enabling View State for Individual Controls
  • Extended Browser Capabilities
  • ASP.NET Chart Control to create visually compelling charts for complex statistical or financial analysis
  • New Field Templates for URLs and E-mail Addresses


Learning days (Calendar)

July 2018
« Jun    

Knowledge Bank (Archives)

I am on Twitter

Blog Stats

  • 549,136 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 43 other followers

%d bloggers like this: