Learning Curve…

Posts Tagged ‘Programming

1. Vertical Scoll position at the bottom of screen

<script type=”text/javascript”>

    function init() {

      var scnWid, scnHei;

      scnWid = document.body.clientWidth;

      scnHei = document.body.clientHeight;

      self.scrollTo(scnWid, scnHei);

    }

    window.onload = init;

  </script>

2. Vertical Scroll position based on a control in the screen

    Below example set scroll position at the start of grid’s header

<script type=”text/javascript”>

    function init() {

      var scnWid, scnHei;

      scnWid = getElementPosition(‘gridName’).left;

      scnHei = getElementPosition(‘gridName’).top;

     self.scrollTo(scnWid, scnHei);

    }

    function getElementPosition(elemID) {

      var offsetTrail = document.getElementById(elemID);

      var offsetLeft = 0;

      var offsetTop = 0;

      while (offsetTrail) {

        offsetLeft += offsetTrail.offsetLeft;

        offsetTop += offsetTrail.offsetTop;

        offsetTrail = offsetTrail.offsetParent;

      }

      return { left: offsetLeft, top: offsetTop };

    }

    window.onload = init;

  </script>

Advertisements

 

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.

http://website/products.aspx?categoryid=12

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

http://website/products/software

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)   {
     RouteTable.Routes.MapPageRoute(“ProductsRoute”,
         “product/{prodId}”, “~/products.aspx”);
}

 

WCF (Indigo was the code name for WCF) is a unification of .NET framework communication technologies. WCF is a unification technology, which unites the following technologies:-
• NET remoting
• MSMQ
• Web services
• COM+.

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:
AutoID
This is equivalent to the algorithm for generating ClientID property values that was used in earlier versions of ASP.NET.

Static
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.

Predictable
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.

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

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

When we create instance of class a special method of that class, called that is constructor. Similarly, when the class is destroyed, the destructor method is called. These are general terms and usually not the actual member names in most object-oriented languages. It is initialized using the keyword New, and is destroyed using the keyword Finalize.

ASP.Net 4.0 introduced a new URL redirection method RedirectPermanent() which avoids round trips.
You can implement this as shown below:

RedirectPermanent(“/newpath/newpage.aspx”);


Author

Learning days (Calendar)

October 2017
M T W T F S S
« Jun    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Knowledge Bank (Archives)

I am on Twitter

Blog Stats

  • 510,411 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: