I found a problem on ASP.net web Applications with read only text boxes not responding to the ‘viewsate’ property set, If you set the ‘readonly’ attribute to true. It will clear the readonly text box text up on postback.

<asp:TextBox ID=”companyTextBox” runat=”server” InvalidColor=”#ff0000″
MinimumPrefixLength=”3″ EnableViewState=”true” ReadOnly=”true”/>

The solution for avoiding clearance was to add the ‘readonly’ property at the run time on the event of each page load.

protected void Page_Load(object sender, EventArgs e)

this.companyTextBox.Attributes.Add(“ReadOnly”, “true”);


At the moment  I cannot understand how this happens. But will find out soon.




.net 3.5 Linq queries does not seem to support date comparison. For example following code did not support.

entities.Object.Where(p => p.ToDateTime.Date>=DateTime.Now.Date
&& p.FromDateTime.Date<= DateTime.Now.Date)

But it supported comparison of date time.

entities.Object.Where(p => p.ToDateTime>=DateTime.Now
&& p.FromDateTime<= DateTime.Now)

Finally found a solution to compare the Date only trough linq query

entities.Object.Where(p => p.ToDateTime>=DateTime.Today
&& p.FromDateTime<= DateTime.Today)

Note:In my case the date object stored in the database recorded 00:00 as its time. In C# with the  DateTime.Today it sets the time to 12:00AM which is 00:00 in SQL.

This worked for me. Hope it’s helpful to you as well

.net 4.0 has some cool features that will enable me to utilize all the hardware resources. The main candidate for this operation is called PLINQ which enables you to execute your LINQ quires in parallel in a Core 2 Duo environment. As my experiment reviled if you use PLINQ it will utilize maximum CPU capability in both processors. where as normal C# or LINQ qury utilized only 50% of the CPU capacity. This made the PLINQ query to execute in double quick time com paired to the normal query.

Normal Query

for (int i = 0; i < 10000000; i++)


Parallel.For(0, 10000000, i => { DoSomethingReallyComplicated(i); });

CPU Usage of PLINQ vs Normal Query

PLINQ used 100% of the CPU and did the work in 23.56 seconds

Normal Query used about 85% form CPU1 and 15% form CPU 2 did the work in 42.86seconds.

Hi All,

I just ran in to a situation where I could not increase the width of the Auto Complete extender with out extending the width of the associated control.Could not find workaround with the DLL it self and had to dig deep and found out a solution  with the editing the following java scrip with in the source code in the file ‘AutoCompleteBehavior.js’ in Auto complete folder.

this._completionListElement.style.width = Math.max(1, elementBounds.width – 2) + ‘px’;

no matter if you manually set the width form the out side this line of code will set the width to bound element -2px so the solution was to either put a solid value to this

this._completionListElement.style.width = “400px”;

This is of couse if you are using it one size all the time

find a solution Here http://www.codeplex.com/AjaxControlToolkit/WorkItem/View.aspx?WorkItemId=13605

I just found a bug in the ajax auto complete extender.  This does not allow multiple instances of the control to appear in the same web page. If you have it with animation Like the element below.It should have a unique name per control. Otherwise you will lose control. When one of the controls is selected it will ends up firing the same event for both the controls.


Solution: You can avoid using animation or css elements form the extenders or use different names for css classes used by them.

found a good work around here :http://forums.asp.net/t/1362679.aspx

Asp.net supports the automatic event fire up. This will raise the relevant methods in the code behind to execute automatically since by default the auto event fire up is true.


· Checks whether the page is a post back

· Create or recreate the web controls dynamically

· Set the theme and the master page.

· Set profile property values


· Read and initialize the control properties.


· processing tasks that require all initialization be complete

PreLoad(before the Load)

· loads view state for itself and all controls

· processes any postback data


· Raise OnLoad event method and all the on load events for all the child controls with in the page.

· set properties in controls

· establish database connections (if any)


· Loads other controls on the page


· make final changes to the contents of the page or its controls


· changes to the page or controls at this point will be ignored

· perform tasks to save the view state


· Page object calls this method on each control

· User control automatically incorporates rendering


· Do final cleanup for specific controls and the page(Close control specific DB connections, closing open files, finishing up logging)

In a page life cycle it is important to understand the stages of the life cycle in order to write the proper coding at the proper stage of the page life cycle.

It performs a series of processing steps

  • · Initialization
  • · Initiating controls
  • · Restoring
  • · Maintain state
  • · Running event handlers
  • · Rendering.

Stages of the page life cycle:-

Page request – User request a web page and it passed to the server and the server determines whether the page need to be compiled and send or cached version can be invoked instead compilation.

Start – Page properties are set and determine whether it is a post back or not. Some of the properties are as follows

· Request

· Response

· IsPostBack

· UICulture

Page initialization– All the controls are available to and the unique id property is also set during this stage. All the themes are applied here; View state values will be yet to be loaded by this stage. So there will be no data on the page.

Load -Properties of all the controls and the data from the view state are being loaded during this stage. This stage can be used for the data binding of the page.

Validation -The validate methods of the validater controls are being called and all the validation are checked, while the isvalid property is being set.

Postback event handling – any the event handlers are being called.

Rendering Page render method for each of the controls are being called, which provides a text writer to the output stream of the page in response.

Unload This is called after the page if being rendered and all the writers are sent to the client. All The response and request are unloaded and the cleanup is performed.