Pages

Wednesday, 31 July 2013

Jquery Date Picker With Various Date Formats.

Hello friends,
             
https://www.youtube.com/watch?v=C8oykuBC0HA&t=2s
Today i gonna show you, how to use J
query based date picker control with various date 
formats as per your requirement, Below is working Code sample, hope this will helpful to you.  


<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
  <meta charset="utf-8" />
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
      $(function () {
          $("#datepicker1").datepicker({ dateFormat: 'dd M yy' }).val();
          $("#datepicker2").datepicker({ dateFormat: 'dd MM yy' }).val();
          $("#datepicker3").datepicker({ dateFormat: 'd M y' }).val();
          $("#datepicker4").datepicker({ dateFormat: 'dd M y' }).val();
          $("#datepicker5").datepicker({ dateFormat: 'dd MM y' }).val();

          $("#datepicker6").datepicker({ dateFormat: 'M dd yy' }).val();
          $("#datepicker7").datepicker({ dateFormat: 'MM dd yy' }).val();
          $("#datepicker8").datepicker({ dateFormat: 'M d y' }).val();
          $("#datepicker9").datepicker({ dateFormat: 'M dd y' }).val();
          $("#datepicker10").datepicker({ dateFormat: 'MM dd y' }).val();

          $("#datepicker11").datepicker({ dateFormat: 'yy dd M' }).val();
          $("#datepicker12").datepicker({ dateFormat: 'yy dd MM' }).val();
          $("#datepicker13").datepicker({ dateFormat: 'y d M' }).val();
          $("#datepicker14").datepicker({ dateFormat: 'y dd M' }).val();
          $("#datepicker15").datepicker({ dateFormat: 'y dd MM' }).val();
      });
  </script>
</head>

<body>
    <form id="form1" runat="server">
    <div>
    <p><b>Below are the various mainly used date formates to display.</b><br /></p>
    <p><b>All Formates with date in front:</b></p>
    <p>DateFormat1:<asp:TextBox ID="datepicker1" runat="server"></asp:TextBox></p>
    <p>DateFormat2:<asp:TextBox ID="datepicker2" runat="server"></asp:TextBox></p>
    <p>DateFormat3:<asp:TextBox ID="datepicker3" runat="server"></asp:TextBox></p>
    <p>DateFormat4:<asp:TextBox ID="datepicker4" runat="server"></asp:TextBox></p>
    <p>DateFormat5:<asp:TextBox ID="datepicker5" runat="server"></asp:TextBox></p>
  

    <p><b>All Formates with Month in front:</b></p>
    <p>DateFormat6:<asp:TextBox ID="datepicker6" runat="server"></asp:TextBox></p>
    <p>DateFormat7:<asp:TextBox ID="datepicker7" runat="server"></asp:TextBox></p>
    <p>DateFormat8:<asp:TextBox ID="datepicker8" runat="server"></asp:TextBox></p>
    <p>DateFormat9:<asp:TextBox ID="datepicker9" runat="server"></asp:TextBox></p>
    <p>DateFormat10:<asp:TextBox ID="datepicker10" runat="server"></asp:TextBox></p>
  
     <p><b>All Formates with year in front:</b></p>
     <p>DateFormat11:<asp:TextBox ID="datepicker11" runat="server"></asp:TextBox></p>
    <p>DateFormat12:<asp:TextBox ID="datepicker12" runat="server"></asp:TextBox></p>
     <p>DateFormat13:<asp:TextBox ID="datepicker13" runat="server"></asp:TextBox></p>
    <p>DateFormat14:<asp:TextBox ID="datepicker14" runat="server"></asp:TextBox></p>
     <p>DateFormat15:<asp:TextBox ID="datepicker15" runat="server"></asp:TextBox></p>
  </div>
</form>
</body>

</html>

Tuesday, 30 July 2013

Calling server side method from javascript in Asp.net

hello friends, I am sharing below working code sample:

https://www.youtube.com/watch?v=C8oykuBC0HA&t=2s

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">
    <!--

        // Javascript function
        function CallSum() {
            var txt1 = $get("txt1");
            var txt2 = $get("txt2");
            var txtresult = $get("txtSum");

            //Call server side function
            PageMethods.Sum(txt1.value, txt2.value, OnCallSumComplete, OnCallSumError, txtresult);

        }

   
        function OnCallSumComplete(result, txtresult, methodName) {
         
            txtresult.value = result;
        }

     
        function OnCallSumError(error, userContext, methodName) {
            if (error !== null) {
                alert(error.get_message());
            }
        }

    // -->
    </script>
</head>
<body>
    <form id="form1" runat="server">
      <asp:ScriptManager ID="sm" runat="server" EnablePageMethods="true">
    </asp:ScriptManager>
    <div>
      <table>
            <tr>
                <td>
                    Number1:
                </td>
                <td>
                    <asp:TextBox ID="txt1" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Number2:
                </td>
                <td>
                    <asp:TextBox ID="txt2" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Sum:
                </td>
                <td>
                    <asp:TextBox ID="txtSum" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnSum" runat="server" Text="Sum" OnClientClick="CallSum();return false;" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>

</html>
.............................................................................................
Below is Code behind:

public partial class CallingServerSideMethodFromJS : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    [System.Web.Services.WebMethod]
    public static int Sum(int arg1, int arg2)
    {

        /* On server side we can do any thing. Like we can access the Session.
         * We can do database access operation. Without postback.
         */
        try
        {
            return arg1 + arg2;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
}

Way to embed a google map to your website


https://www.youtube.com/watch?v=C8oykuBC0HA&t=2s
Hey friends, this is hardik jain. Today i gonna share you the way, how to embed a google map ? for a specific location address in your own website page using iframe.

Step 1: First of all go to below link:

https://maps.google.co.in/


Step 2: Now Type full address of (your company or home or building) which you want to show in map.
inside the google search textbox and click on search button as shown below in below snap:
















Step 3: Now just below that text box you will see a link tab as highlited in below snap. just click it.














Step 4: Now you would see a below popup,in which just copy the link(an iframe tag) given inside below textbox.


 

 Step5: Paste this iframe tag inside body of your web page as shown below.


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.co.in/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Newcon+Infosystems,+RNT+Marg,+Chhoti+Gwaltoli,+Indore,+Madhya+Pradesh&amp;aq=0&amp;oq=newconinfosys&amp;sll=22.717152,75.871829&amp;sspn=0.001403,0.002642&amp;ie=UTF8&amp;hq=Newcon+Infosystems,&amp;hnear=RNT+Marg,+Chhoti+Gwaltoli,+Indore,+Madhya+Pradesh&amp;t=m&amp;ll=22.717152,75.871829&amp;spn=0.006295,0.006295&amp;output=embed"></iframe>
    <br />
    <small><a href="https://maps.google.co.in/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=Newcon+Infosystems,+RNT+Marg,+Chhoti+Gwaltoli,+Indore,+Madhya+Pradesh&amp;aq=0&amp;oq=newconinfosys&amp;sll=22.717152,75.871829&amp;sspn=0.001403,0.002642&amp;ie=UTF8&amp;hq=Newcon+Infosystems,&amp;hnear=RNT+Marg,+Chhoti+Gwaltoli,+Indore,+Madhya+Pradesh&amp;t=m&amp;ll=22.717152,75.871829&amp;spn=0.006295,0.006295" style="color:#0000FF;text-align:left">View Larger Map</a></small>
    </div>
    </form>
</body>
</html>

step 6: Press F5 to run the code and enjoy.........