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;
                }
        }  

}

How apply css class on on a control using javascript


function SetActive(Link1,Link2,Link3)
{
debugger;
document.getElementById(Link1).className="place-order-active";
document.getElementById(Link2).className ="place-order";
document.getElementById(Link3).className ="place-order";
}

How show 10 cities for every city in a Single colum in a table

WITH TABL AS
(select row_number() over(partition by CITY order by CITY) row,city from address
where city in( select distinct city from address))
SELECT CITY FROM TABL WHERE ROW <11

How to Enable Disable Required Field Validator using JavaScript

 function autoSelect()
{   
var DelRecvName = document.getElementById("TxtDelRecvName").value;  
  if (DelRecvName == "")   
    { 
    ValidatorEnable(document.getElementById("RequiredFieldValidator3"), false);                          ValidatorEnable(document.getElementById("RequiredFieldValidator10"), false);         ValidatorEnable(document.getElementById("RequiredFieldValidator13"), false);         ValidatorEnable(document.getElementById("RequiredFieldValidator14"), false);        }       
else    
   {       
 ValidatorEnable(document.getElementById("RequiredFieldValidator3"), true);         ValidatorEnable(document.getElementById("RequiredFieldValidator10"), true);         ValidatorEnable(document.getElementById("RequiredFieldValidator13"), true);         ValidatorEnable(document.getElementById("RequiredFieldValidator14"), true); 
      } 
}

Monday, March 26, 2012

Generating Random Number and String in Generating the Password Automatically By using asp.net with vb.net

open the visual studio 
select the new website

After that copy and paste the following code in aspx page<html xmlns="http://www.w3.org/1999/xhtml">

Tuesday, January 17, 2012

How to Bind Data List With Product Images From Database


How to Bind With Data List:



<asp:DataList ID="DlProducts" runat="server" Height="138px" Width="416px" Font-Names="Verdana" Font-Size="Small">
   
 <ItemTemplate>
    <div style="border:1px solid black;" id ="divProd" runat=server>
        <table style="width: 550px">
        <tr align =left>
            <td rowspan="4" style="width: 126px;border:0px;" align =left>
                <asp:Label ID="LblProdId" runat ="server" CssClass="LabelStyle" Text='<%# DataBinder.Eval(Container.DataItem, "Product_id") %>' Width="200px" Font-Bold =true Visible=false ></asp:Label>
                <asp:Image ID="Img" runat="server" Height="60px" ImageUrl='<%# "Picture.aspx?id=" & Eval("Product_id")%>' Width="70px" />
               
                </td>
            <td style="width: 224px">
                        <asp:Label ID="ProdName" runat ="server" CssClass="LabelStyle" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' Width="200px" Font-Bold =true></asp:Label></td>
            <td style="width: 102px">
                            <asp:Label ID="LblQty" runat="server" Font-Names="Verdana" Font-Size="Small" Text="Quantity" Visible=false></asp:Label>
                            <asp:Label ID="LblWeight" runat="server" Font-Names="Verdana" Font-Size="Small" Text="Select Weight"></asp:Label>
                            </td>
            <td>
                            <asp:TextBox ID="txtqty" runat="server" Width="64px" Height=14px Text = "1" style="text-align:right;" OnTextChanged="txtqty_TextChanged" AutoPostBack="True" Visible =false></asp:TextBox>
                            <asp:DropDownList ID="DdlWeight" runat="server" Width = 70px Height = 19px  AutoPostBack ="true" OnSelectedIndexChanged ="DdlWeight_SelectedIndexChanged"
                               
                                DataSource = '<% #DdlBindWeight(Eval("Product_id"))%>' DataValueField = "data_id" DataTextField = "data"
                                Font-Size="12px" CssClass = "SetIndex"></asp:DropDownList>
                            </td>
        </tr>
        <tr>
            <td style="width: 224px">
                        <asp:Label ID="lblAmount" runat ="server" CssClass="LabelStyle" Text='<%# DataBinder.Eval(Container.DataItem, "Sales_Price") %>' Width="200px"></asp:Label>
                        <asp:Label ID="CalAmt" runat ="server" CssClass="LabelStyle" Text='<%# DataBinder.Eval(Container.DataItem, "Price") %>' Width="200px" Visible =false></asp:Label>
                        </td>
            <td style="width: 102px">
            </td>


        </tr>
        <tr>
            <td style="width: 224px; height: 21px">
                        <asp:Label ID="Label3" runat ="server" CssClass="LabelStyle" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>' Width="200px"></asp:Label></td>
            <td style="width: 102px; height: 21px">
            </td>
            <td style="height: 21px">
            </td>
        </tr>
        <tr>
            <td style="width: 224px">
            </td>
            <td style="width: 102px">
            </td>
            <td>
            </td>
        </tr>
    </table>             
          
</div>
 </ItemTemplate>
       
</asp:DataList>