Getting Started with Adobe After Effects - Part 6: Motion Blur

Upload Image Close it
Select File

Browse by Tags · View All
BRH 48
jQuery 22
.NET 20
jquery interview questions 9
jquery faq 8

Archive · View All
February 2011 10
September 2011 4
August 2011 4
July 2011 4
May 2011 4
April 2011 4
March 2011 4
October 2011 4
June 2011 4
January 2011 4

All about Client ID Mode in ASP.NET 4

Jul 16 2010 11:42AM by Hima   


We have been using ClientID’s in ASP.NET 2.0/3.5 that makes each control to generate the unique client side id attribute to that page or browser. But these ID’s were long and randomly generated. Developers who work on Client-Side programming that uses Java Script, JQuery or Ajax have been suffering a lot spending considerable amount of time when it they need to reference those ClientID’s in the client side scripts.

Now the good news is that, ASP.NET 4.0 comes with new ClientIDMode property, gives full control to the developer on the ClientID’s generated by ASP.NET controls.

ClientIDMode can take the following four possible values

  • AutoID - ASP.NET generate IDs as it does in v3.5 and earlier versions.
  • Static - ASP.NET use exactly the same ID given to the server control for its client-side ID.
  • Predictable - ASP.NET try to generate IDs that are guessable from looking at the structure of the page.
  • Inherit - ASP.NET generate a client-side ID for the page or control using the same ClientIDMode as its parent. i.e. the client ID gets inherited from the parent control.

You can set this property in 3 ways

1.Control Level

2.Page Level

3.Application Level

Setting ClientIDMode at Control Level

Each and every server control in ASP.NET 4.0 has this property and the default value is inherit.

<asp:panel id="pnl" runat="server" cssclass="newStyle1"
ClientIDMode ="Static"> </asp:panel>

Setting ClientIDMode at Page Level

<%@ Page Language="C#" ClientIDMode ="Inherit"
Inherits="WebApplication3.Cat" %> 

Setting ClientIDMode at Application Level

You need to set it at System.Web section of Web.config

<pages clientIDMode="Predictable">


Another interesting feature of the ClientID improvement in ASP.NET 4.0 is the ClientIDRowSuffix .This can be applied to DataBound or List controls. This is used to take control on how ID values for template controls in databound controls are generated. This requires that the ClientIDMode is set to Predictable.

<asp:GridView runat="server" 
ID="gvEmp" AutoGenerateColumns="False" 
ClientIDMode ="Predictable" ClientIDRowSuffix="EMPID">

Best Practices

  • Add ClientIDMode = "Static" in application level web.config
  • Using ClientIDMode = "AutoId" will work the best even in worst cases.
  • Add ClientIDMode = "Predictable" to each List Control Children Item Template of Databound Controls.
  • When ever naming conflicts occurs Override ClientIDMode to Predictable
  • When working with Web Server Control Development leave at default behavior i.e. Inherit from parent
  • Override if and only if necessary that might be in individual sub controls

Tags: BRH, #DOTNET, ASP.NET4, #ASP.NET, ClientID, ClientIDMode at application level, ClientIDMode at Page level, ClientIDMode,

31 · 6% · 1776


Your Comment

Sign Up or Login to post a comment.

"All about Client ID Mode in ASP.NET 4" rated 5 out of 5 by 1 readers
All about Client ID Mode in ASP.NET 4 , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]