Friday, March 11, 2011

How to deal with Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Do not add same kind user control twice with different name into same placeholder if Viewstate is Enabled

Weird bug, how to handle dynamically loaded user control events not firing on first click

For every usercontrol,  need to set  ID property before adding. And don’t use Guid
Control ctl = this.LoadControl("usercontrol.ascx");
ctl.ID = "ctl" + i.ToString();
Panel1.Controls.Add(ctl);

Security Guidelines: ASP.NET 2.0

http://msdn.microsoft.com/en-us/library/ms998258.aspx

Thursday, March 10, 2011

How to handle Apostrophe in Javascript

Use double quotes instead of singele quote.

var WaterMark = "<%= Resources.General.Hint %>";

C# Object Type Comparison

Is
if (obj is MyObject)
{
}