Il est bien plus beau de savoir quelque chose de tout que de savoir tout d'une chose. [Blaise Pascal]

Some tips on ASP.NET, 70-562 certification cheat sheet

2 comments
I wanted with this post to give a list of tips around asp.net (as part of my next certification 70-562 TS Microsoft .NET Framework 3.5, ASP.NET Application Development)
The first element ASP.net developer should know is the ASP.net page life cycle. Knowing this area will allow you to correctly initialize controls. Here is a great article on MSDN on the life cycle, which details the following sections:
·         General Page Life-cycle Stages
·         Life-cycle Events
·         Login Control Events

The second point is related to page redirection and page transfer. What is the difference between:
·         Response.Redirect("url");
·         Server.Transfer("url");
·         HttpContext.Current.RewritePath("url");

This article gives a very good comparison between Response.Redirect and Server.Transfer.
As a summary, the author gives the following points:
·         Response.Redirect is more user-friendly, as the site visitor can bookmark the page that they are redirected to.
·         Transferred pages appear to the client as a different url than they really are. This means that things like relative links / image paths may not work if you transfer to a page from a different directory.
·         Server.Transfer has an optional parameter to pass the form data to the new page.
The last option, HttpContext.Current.RewritePath, is cleverly detailed in this article with a very simple to understand example.
The detail of the HttpContext.RewritePath Method is explained in this MSDN article.

The third tip of this post is the difference between #EVAL and #BIND.
In few words, #EVAL is one-way(read-only) and #BIND is a two-way (updatable) binding.
Data-binding expressions are contained within <%# and %> delimiters and use the Eval and Bind functions. The Eval function is used to define one-way (read-only) binding. The Bind function is used for two-way (updatable) binding. In addition to calling Eval and Bind methods to perform data binding in a data-binding expression, you can call any publicly scoped code within the <%# and %> delimiters to execute that code and return a value during page processing.
Very stupid stuff to remember, single-quotes should be used and not double-quotes
<asp:TextBox Runat="server" ID="txtProductName" Text='<%# Bind("ProductName") %>' />

Forth tip, let's discuss about AJAX and the difference between $get and $find
$get is an alias for getElementById. In addition, this function has additional code for those browsers that have not implemented getElementById. (Labels, textboxes are example of elements)
$find is a shortcut for Sys.Application.findComponent. (Widgets like calendars are examples of components)
This excellent article gives a quick summary of the differences:
·         Both, $get and $find, appear return a reference to a DOM object created using mark-up or at runtime
·         Both, $get and $find, appear to return a component reference
·         While both methods work on elements and components, it’s recommended to use $get for elements and $find for components.

2 comments :

  1. This is a nice article..
    Its easy to understand ..
    And this article is using to learn something about it..

    c#, dot.net, php tutorial, Ms sql server

    Thanks a lot..!
    ri70

    ReplyDelete
  2. dot net is one of most popular programming languages today, It is easy to learn as compared to java, and yet it is powerful. well written post on .net training

    ReplyDelete

Note: Only a member of this blog may post a comment.