Friday, August 12, 2011

Some Useful Regular Expression Validations

1) http(s)://www.examplesite.com
    ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"

2) Email Address
    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"

Solution to Page_Load event not fire

Add following code in your page:

#region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
        //
        // CODEGEN: This call is required by the ASP.NET Web Form Designer.
        //
        InitializeComponent();
        base.OnInit(e);
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        this.Load += new System.EventHandler(this.Page_Load);
    }
    #endregion





Thursday, August 11, 2011

Solution to UpdateProgress bug in Safari

Fisrt Create one js file with name SafariSolution.js with follwing code

Sys.Browser.WebKit = {};
if( navigator.userAgent.indexOf( 'WebKit/' ) > -1 )
{
  Sys.Browser.agent = Sys.Browser.WebKit;
  Sys.Browser.version = parseFloat( navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);
  Sys.Browser.name = 'WebKit';
}

After add path to ScriptManager :
__________________________________

<asp:ScriptManager ID="ScriptManager1" runat="server">
     <Scripts>
         <asp:ScriptReference Path="~/Scripts/SafariSolution.js" />
     </Scripts>
</asp:ScriptManager>

after that add PostBackTrigger code to Button :
________________________________________________

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
        <Triggers>
                <asp:PostBackTrigger ControlID="btnNewTestimonial" />               
        </Triggers>
   </ContentTemplate>
</asp:UpdatePanel>