Thursday, May 31, 2012

Using JavaScript, we can forward the user to the same page if user presses the back button of the browser. See the code below :

 <script type="text/javascript" language="javascript">
    
    function GoBack()
    {
        window.history.forward();
    }
    </script>
 
 
Call this JavaScript function on the onload event of body tag.
 
<body onload="GoBack();">

Thursday, April 26, 2012

Friday, April 6, 2012

How to show Processing Image with Update Progress control


<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="100">
        <ProgressTemplate>
<%--            <asp:Image ID="Image1" runat="server" Height="77px" ImageUrl="~/images/brocolli.jpg"
                Width="166px" />--%>
                        <div style="background-color: Gray; filter:alpha(opacity=60); opacity:0.60; width: 100%; top: 0px; left: 0px; position: fixed; height: 100%;">
        </div>
          <div style="margin:auto;
              font-family:Trebuchet MS;
              filter: alpha(opacity=100);
              opacity: 1;
              font-size:small;
              vertical-align: middle;
              top: 45%;
              position: fixed;
              right: 45%;
              color: #275721;
              text-align: center;
              background-color: White;
              height: 100px;
              ">
              <br />
             
                <table style=" background-color: White; font-family: Sans-Serif; text-align: center; border: solid 1px #275721; color: #275721; width: inherit; height: inherit; padding: 15px;">
                <tr>
                <td style=" text-align: inherit;"><img src="images/RoundProgress.gif" alt="Loading"  /></td>
                <td style=" text-align: inherit;"><span style="font-family: Sans-Serif; font-size: medium; font-weight: bold; font">Loading...</span></td>
                </tr>
                </table>
        </div>
        </ProgressTemplate>
    </asp:UpdateProgress>

Issue of Global.asax file not excuting at Hosting server

Some times It happens that When we publish our project then it generates .dll file of global.asax, In this case some times hosting server do not execute global.asax file. For getting rid from this problem follow the steps:

1. Only copy global.asax file into wwwroot folder,Now it will work fine.

2. Do not copy assembly of global.asax .dll(assembly) file into bin folder.

Password Matching matching code in javascript


function CheckPwd()
{
var fpwd = document.getElementById("TxtRegPwd1").value;
var ConfmPwd = document.getElementById("TxtRegPwd2").value;
        if(fpwd != ConfmPwd)
        {
         alert('Password did not match !');
         document.getElementById("TxtRegPwd1").value = "";
         document.getElementById("TxtRegPwd2").value = "";
         document.getElementById("TxtRegPwd1").focus();
        
         return false;
        }
}
function CheckPwd2()
{
var fpwd = document.getElementById("TxtRegPwd1").value;
var ConfmPwd = document.getElementById("TxtRegPwd2").value;
if (ConfmPwd != "")
    {
        if(fpwd != ConfmPwd)
        {
         alert('Password did not match !');
         document.getElementById("TxtRegPwd1").value = "";
         document.getElementById("TxtRegPwd2").value = "";
         document.getElementById("TxtRegPwd1").focus();
        
         return false;
        }
     }
}

How to compare two dates and How to Know Sunday on the particular date in Java Script

function todaydate()
    {
    debugger;
    var Todaydate =new Date() ;
    var TextBoxDate=document.getElementById("TxtDate").value;
        var currentDate = new Date()
        var day = currentDate.getDate()
        var month = currentDate.getMonth() + 1
        var year = currentDate.getFullYear()
       
        if (TextBoxDate.length < 10)
        {
         alert('Please Enter Correct Date!');
         return false;
        }
       
        if (month < 10)
            {
       Todaydate= ("0" + month + "/" + day + "/" +  year) ;
            }
        else
            {
       Todaydate= (month + "/" + day + "/" +  year) ;
            }       
       var ConvertTodayDate= Date.parse (Todaydate);       
        var date1 = new Date(ConvertTodayDate)    
    
        var day1 = TextBoxDate.substring(0,2);
        var month1 = TextBoxDate.substring(4,5);
        var year1 = TextBoxDate.substring(6,10);
    
      if (month1 < 10)
            {
  TextBoxDate= ("0" + month1 + "/" + day1 + "/" +  year1) ;
            }
        else
            {
   TextBoxDate= (month1 + "/" + day1 + "/" +  year1) ;
            }
           
       var  ConvertTextBoxDate= Date.parse (TextBoxDate);
       var date2 = new Date(ConvertTextBoxDate)



      if (date2  < date1)
        {
alert("Order cannot be booked for same day and back day !");
            return false
        }
     
       if (Todaydate == TextBoxDate)
         {
alert("Order cannot be booked for same day and back day !");
            return false
         }

        //Given Below Line for Getting Sunday

        var forsunday = date2.getDay(); 
        if (forsunday == 0)
         {
        alert("Order cannot be booked for Sunday!");
        return false
         } 
        
         if(document.form1.DDlDelTime.selectedIndex==0)
         {
         alert('Please Select Delivery Time. !')
        
         return false;
         }
        
      var IISHours = document.getElementById("LblHours").innerHTML;
      var Min = document.getElementById("LblMin").innerHTML;
      var IISDate = document.getElementById("LblDate").innerHTML;
      TextBoxDate=document.getElementById("TxtDate").value;



        if (IISDate == TextBoxDate)
        {
                if (IISHours > 22 && Min > 0)
                {
                alert('Order cannot be booked for Tomorrow after 10 PM.');
                return false;
                }
        }  

}