Saturday, 29 September 2012

Test Credit Card Account Numbers


Test Credit Card Account Numbers

Credit Card Type
Credit Card Number
American Express
378282246310005
American Express
371449635398431
American Express Corporate
378734493671000
Australian BankCard
5610591081018250
Diners Club
30569309025904
Diners Club
38520000023237
Discover
6011111111111117
Discover
6011000990139424
JCB
3530111333300000
JCB
3566002020360505
MasterCard
5555555555554444
MasterCard
5105105105105100
Visa
4111111111111111
Visa
4012888888881881
Visa
4222222222222
Note : Even though this number has a different character count than the other test numbers, it is the correct and functional number.
Processor-specific Cards
Dankort (PBS)
76009244561
Dankort (PBS)
5019717010103742
Switch/Solo (Paymentech)
6331101999990016

Wednesday, 26 September 2012

Ajax model pop up


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="samplemodel.aspx.cs" Inherits="vScreenSite.pages.samplemodel" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">

.ModalPopupBG
{
    background-color: #666699;
    filter: alpha(opacity=50);
    opacity: 0.7;
}

.HellowWorldPopup
{
    min-width:200px;
    min-height:150px;
    background:white;
}
    </style>
</head>
<body>
    <form id="form1" runat="server">
 <cc1:ToolkitScriptManager ID="tlkt1" runat="server">
                </cc1:ToolkitScriptManager>
<%--<asp:button id="Button1" runat="server" text="Button" />--%>

<%--<cc1:modalpopupextender id="ModalPopupExtender1" runat="server"
cancelcontrolid="btnCancel" okcontrolid="btnOkay"
targetcontrolid="Button1" popupcontrolid="Panel1"
popupdraghandlecontrolid="PopupHeader" drag="true"
backgroundcssclass="ModalPopupBG">
</cc1:modalpopupextender>--%>



<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Button ID="btnLogin1" runat="server" Text="Already have an account? Log in." OnClick="btnLogin1_Click" />
        <asp:Button ID="BtnTarget" runat="server" Text="Target" Style="display: none" />
       
        <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="BtnTarget"
            PopupControlID="Panel1">
        </cc1:ModalPopupExtender>
        <asp:Panel ID="Panel1" runat="server" BackColor="WhiteSmoke" Width="300px" Height="200px">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                <table>
                <tr>
                <td>
                    <asp:Label ID="lblEmail" runat="server" Text="enter id value"></asp:Label>
                </td>
                <td>
                 <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
                </td>
                 
                </tr>
                <tr>
                <td><asp:Label ID="lblPassword" runat="server" Text="enter pass value"></asp:Label>
             
                </td>
                <td><asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
                </td>
                </tr>
                </table>
                <asp:Label ID="lbl" runat="server" ></asp:Label>
               
                    <asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" />
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnLogin" EventName="Click" />
                </Triggers>
            </asp:UpdatePanel>
        </asp:Panel>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnLogin1" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
    </form>
</body>
</html>

codebehind file code

    protected void btnLogin1_Click(object sender, EventArgs e)
        {
            ModalPopupExtender1.Show();
            txtEmail.Text = "sai";
            txtPassword.Text = "babu";
     
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtEmail.Text == "sai" && txtPassword.Text == "babu")
            {
                Response.Redirect("child_login.aspx");
            }
            else
            {
                ModalPopupExtender1.Show();
                lbl.Text = txtEmail.Text;
            }
          //  Response.Write(TextBox1.Text+" and "+TextBox2.Text);
          //  Response.Redirect("child_login.aspx");
        }
    }



Monday, 24 September 2012

facebook share


 <script>
        function fbs_click()
         {
            u = location.href;
            t = document.title;
         window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436'); return false; }</script>
    <style>
        html .fb_share_link
        {
            padding: 2px 0 0 20px;
            height: 16px;
            background: url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat top left;
        }
    </style>
    <a rel="nofollow" href="http://www.facebook.com/share.php?u=>" onclick="return fbs_click()"
        target="_blank" class="fb_share_link">Share on Facebook</a>

Thursday, 20 September 2012

twitter share code

<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.domain.com/gfgf+11/" runat="server"  data-count="none" data-via="AnGe7s" data-lang="fr">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>






Properties which can be used by all types of the Tweet Button

The properties in this table can be used by the Javascript, IFRAME and build your own Tweet Buttons. Each property is a query string parameter for the https://twitter.com/share URL.

Query String Parameter   Description
url                                  URL of the page to share
via                                 Screen name of the user to attribute the Tweet to
text                                 Default Tweet text
related                         Related accounts
count                        Count box position
lang                               The language for the Tweet Button
counturl                       URL to which your shared URL resolves
hashtags                      Comma separated hashtags appended to tweet text
size                               The size of the rendered button
dnt                                See this section for information
Properties which can be used by the Javascript Tweet Button

The properties in this table can only be used by the Javascript Tweet Button. When used they provide additional places the Tweet Button can look for information on what to pre fill the Tweet with. The Tweet Button looks for property values in the priority order given in the table. For example when looking for the URL to use, the Tweet Button will:


Monday, 17 September 2012

Radio button validation


  <asp:Button ID="btnStep3" CssClass="btn-continue" runat="server" Text="Continue" OnClientClick="return validateRadio();" ValidationGroup="SignUP" OnClick="btnStep3_Click" />
            <script type="text/javascript">
                function validateRadio() {
                    var ErrorMessage = '';
                   // var ErrorMessage1 = '';
                    var GvId = document.getElementById('<%=TxtbxGvtID.ClientID%>');
                    //debugger;
                    if (GvId.value.length == 0) {
                        ErrorMessage = "Please enter Government ID \n";
                    } else if (isNaN(parseInt(GvId.value))) {
                    ErrorMessage += "Please Enter Numeric Value in Govt Id \n";
                                     
                    }          
               
                var Ck1 = document.getElementById('<%=rbn1Year.ClientID %>');
                //debugger;
                var Ck2 = document.getElementById('<%=rb2Year.ClientID %>');
                var Ck3 = document.getElementById('<%=rbing3to5years.ClientID %>');
                var Ck4 = document.getElementById('<%=rbingMoreThan5years.ClientID %>');

                var Ck5 = document.getElementById('<%=rbOptionExperienceLessThan1year.ClientID %>');
                var Ck6 = document.getElementById('<%=rbOptionExperience1to2years.ClientID %>');
                var Ck7 = document.getElementById('<%=rbOptionExperience3to5years.ClientID %>');
                var Ck8 = document.getElementById('<%=rbOptionExperienceMoreThan5Years.ClientID %>');


                var Ck9 = document.getElementById('<%=rbExperienceLessThan1Yers.ClientID %>');
                var Ck10 = document.getElementById('<%=rbExperience1to2years.ClientID %>');
                var Ck11 = document.getElementById('<%=rbExperience3to5years.ClientID %>');
                var Ck12 = document.getElementById('<%=rbCDFTradingExperienceMoreThan5Years.ClientID %>');

                var Ck13 = document.getElementById('<%=rbExperienceLessThan1Year.ClientID %>');
                var Ck14 = document.getElementById('<%=rbExperience1to2years.ClientID %>');
                var Ck15 = document.getElementById('<%=rbExperience3to5years.ClientID %>');
                var Ck16 = document.getElementById('<%=rbFutresMoreThan5Years.ClientID %>');

                var Ck17 = document.getElementById('<%=rbExperienceLessThan1Year.ClientID %>');
                var Ck18 = document.getElementById('<%=rbExperience1to2years.ClientID %>');
                var Ck19 = document.getElementById('<%=rbExperience3to5years.ClientID %>');
                var Ck20 = document.getElementById('<%=rbExperienceMoreThan5years.ClientID %>');


                if (Ck1.checked == true || Ck2.checked == true || Ck3.checked == true || Ck4.checked == true) { } else { ErrorMessage += "Please fill Currency’s trading experience?\n"; }
                if (Ck5.checked == true || Ck6.checked == true || Ck7.checked == true || Ck8.checked == true) { } else { ErrorMessage += "Please fill experience?\n"; }
                if (Ck9.checked == true || Ck10.checked == true || Ck11.checked == true || Ck12.checked == true) { } else { ErrorMessage += "Please fill  CDF/Commodities trading experience? \n"; }
                if (Ck13.checked == true || Ck14.checked == true || Ck15.checked == true || Ck16.checked == true) { } else { ErrorMessage += "Please fill Futures trading experience\n"; }
                if (Ck17.checked == true || Ck18.checked == true || Ck19.checked == true || Ck20.checked == true) { } else { ErrorMessage += "Please fill Securities trading experience?\n"; }

                if (ErrorMessage.length != 0) {
                    alert(ErrorMessage);
                   //alert(ErrorMessage1);
                    return false;
                }

Saturday, 15 September 2012

reading xml to dataset


//reading the xml data to dataset
            DataSet ds = new DataSet();
            ds.ReadXml(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString()) + ".xml");
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();

creating and adding data to xml



//creating xml document if not exists

  if (!File.Exists(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString()) + ".xml"))
            {
                XmlTextWriter xtw = new XmlTextWriter(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString()) + ".xml", System.Text.Encoding.UTF8);
                xtw.WriteStartDocument(true);
                xtw.WriteStartElement("root");
                xtw.WriteStartElement("File");
                xtw.WriteElementString("FileName", System.IO.Path.GetFileName( FileUploadProof.PostedFile.FileName));
                xtw.WriteElementString("UploadedDate", DateTime.Now.Date.ToShortDateString());
                xtw.WriteElementString("FileType", ddlProofType.SelectedItem.Text.Trim());
                xtw.WriteEndElement();
                xtw.WriteEndDocument();
                xtw.Close();

            }
            else
            {
//adding info to xml
                XmlDocument doc = new XmlDocument();
                doc.Load(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString()) + ".xml");
                XmlElement el = doc.CreateElement("File");

                XmlElement el1 = doc.CreateElement("FileName");
                el1.InnerText =  System.IO.Path.GetFileName(  FileUploadProof.PostedFile.FileName);
                doc.DocumentElement.AppendChild(el).AppendChild(el1);

                XmlElement el2 = doc.CreateElement("UploadedDate");
                el2.InnerText = System.DateTime.Now.Date.ToShortDateString();
                doc.DocumentElement.AppendChild(el).AppendChild(el2);

                XmlElement el3 = doc.CreateElement("FileType");
                el3.InnerText = ddlProofType.SelectedItem.Text;

                doc.DocumentElement.AppendChild(el).AppendChild(el3);

                doc.DocumentElement.AppendChild(el);
                doc.Save(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString()) + ".xml");

            }



Upload file


 // Get a reference to PostedFile object
          HttpPostedFile myFile = FileUploadProof.PostedFile;

        // Get size of uploaded file
        int nFileLen = myFile.ContentLength;

        // Allocate a buffer for reading of the file
        byte[] myData = new byte[nFileLen];

        // Read uploaded file from the Stream
        myFile.InputStream.Read(myData, 0, nFileLen);

//check if directory folder is exists or not

if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString())))
  {                Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString()));

//it is used to save the uploaded file
                FileUploadProof.SaveAs(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString() + "/" +  System.IO.Path.GetFileName( FileUploadProof.FileName)));

            }
            else
            {
         
                FileUploadProof.SaveAs(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString() + "/" + System.IO.Path.GetFileName(FileUploadProof.FileName)));
            }


Read xml data to dataset


 if (File.Exists(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString()) + ".xml"))
        {
            DataSet ds = new DataSet();
            ds.ReadXml(HttpContext.Current.Server.MapPath("~/UploadFile/" + Session["Name"].ToString()) + ".xml");
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
        }

Friday, 14 September 2012

Use this regular expression to allow only single dot


Use this regular expressin to allow only single dot
^[1-9]\d*(\.\d+)?$


 <asp:TextBox ID="txtNumber" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ControlToValidate="txtNumber"
                    runat="server" ValidationExpression="^[1-9]\d*(\.\d+)?$"
                        ErrorMessage="Please enter only numbers">
                    </asp:RegularExpressionValidator>

Only Number validation in Textbox of ASP.NET Using Regular Expression validator


Only Number validation in Textbox of ASP.NET Using Regular Expression validator


Only numbers can enter into that Textbox

We can use Regular expression validator for this:

In the validation expression property keep ^\d+$.

<asp:TextBox ID="TextBox1" runat="server" Style="z-index: 100; left: 259px; position: absolute;

top: 283px" ValidationGroup="check"></asp:TextBox>


<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"

ErrorMessage="Please Enter Only Numbers" Style="z-index: 101; left: 424px; position: absolute;

top: 285px" ValidationExpression="^\d+$" ValidationGroup="check"></asp:RegularExpressionValidator>

Wednesday, 12 September 2012

Radio btn client validation


  <asp:Button ID="btnStep3" CssClass="btn-continue" runat="server" Text="Continue" OnClientClick="return validateRadio();" ValidationGroup="SignUP" OnClick="btnStep3_Click" />
            <script type="text/javascript">
                function validateRadio() {
                    var ErrorMessage = '';
                   // var ErrorMessage1 = '';
                    var GvId = document.getElementById('<%=TextBoxGovernmentID.ClientID%>');
                    //debugger;
                    if (GvId.value.length == 0) {
                        ErrorMessage = "Please enter Government ID \n";
                    } else if (isNaN(parseInt(GvId.value))) {
                    ErrorMessage += "Please Enter Numeric Value in Govt Id \n";
                                     
                    }          
               
                var Ck1 = document.getElementById('<%=rb1Year.ClientID %>');
                //debugger;
                var Ck2 = document.getElementById('<%=rb1to2Year.ClientID %>');
                var Ck3 = document.getElementById('<%=rb3to5years.ClientID %>');
                var Ck4 = document.getElementById('<%=rb5years.ClientID %>');

                var Ck5 = document.getElementById('<%=rbThan1year.ClientID %>');
                var Ck6 = document.getElementById('<%=rb1to2years.ClientID %>');
                var Ck7 = document.getElementById('<%=rb3to5years.ClientID %>');
                var Ck8 = document.getElementById('<%=rbrs.ClientID %>');


                var Ck9 = document.getElementById('<%=rb1Yers.ClientID %>');
                var Ck10 = document.getElementById('<%=rb1to2years.ClientID %>');
                var Ck11 = document.getElementById('<%=rbo5years.ClientID %>');
                var Ck12 = document.getElementById('<%=rbThan5Years.ClientID %>');

                var Ck13 = document.getElementById('<%=rbeLessThan1Year.ClientID %>');
                var Ck14 = document.getElementById('<%=rb2years.ClientID %>');
                var Ck15 = document.getElementById('<%=rb3to5years.ClientID %>');
                var Ck16 = document.getElementById('<%=rbFutresMoreThan5Years.ClientID %>');

                var Ck17 = document.getElementById('<%=rbExperienceLessThan1Year.ClientID %>');
                var Ck18 = document.getElementById('<%=rbExperience1to2years.ClientID %>');
                var Ck19 = document.getElementById('<%=rbExperience3to5years.ClientID %>');
                var Ck20 = document.getElementById('<%=rbMoreThan5years.ClientID %>');


                if (Ck1.checked == true || Ck2.checked == true || Ck3.checked == true || Ck4.checked == true) { } else { ErrorMessage += "Please fill \n"; }
                if (Ck5.checked == true || Ck6.checked == true || Ck7.checked == true || Ck8.checked == true) { } else { ErrorMessage += "Please fi\n"; }
                if (Ck9.checked == true || Ck10.checked == true || Ck11.checked == true || Ck12.checked == true) { } else { ErrorMessage += "Please fill   \n"; }
                if (Ck13.checked == true || Ck14.checked == true || Ck15.checked == true || Ck16.checked == true) { } else { ErrorMessage += "Please fill\n"; }
                if (Ck17.checked == true || Ck18.checked == true || Ck19.checked == true || Ck20.checked == true) { } else { ErrorMessage += "Please ?\n"; }

                if (ErrorMessage.length != 0) {
                    alert(ErrorMessage);
                   //alert(ErrorMessage1);
                    return false;
                }