problem using javascript in .net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shahidrasul
    New Member
    • Aug 2008
    • 18

    problem using javascript in .net

    i have two problem

    1. how to call a javascript function from form page and also how to call c# function from javascript because when user click on button i want to validate field of form and if validation is correct then call to c# function .
    please any no about this reply

    2. in second i have button when i click on button a calender shown and i collect date but problem is when i click on button i page reload , i want to stop reloading of page

    in coding i set the value of calender visible true
    please any body no about answer reply me
  • joedeene
    Contributor
    • Jul 2008
    • 579

    #2
    considering this is in the .net forum and you are referring to C# for part of the question, i'd suggest editing the title as this forum is for .net, just at least put something with c sharp in it rather than javascript

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      Good catch. Please use descriptive titles when posting. It makes it easier for the experts to find the threads that they can help with, and if they can find it, they can help you

      MODERATOR.

      Comment

      • shahidrasul
        New Member
        • Aug 2008
        • 18

        #4
        problem using javascript in .net

        i have two problem

        1. how to call a javascript function from form page and also how to call c# function from javascript because when user click on button i want to validate field of form and if validation is correct then call to c# function .
        please any no about this reply

        2. in second i have button when i click on button a calender shown and i collect date but problem is when i click on button i page reload , i want to stop reloading of page

        in coding i set the value of calender visible true
        please any body no about answer reply me

        Comment

        • kenobewan
          Recognized Expert Specialist
          • Dec 2006
          • 4871

          #5
          What have you tried so far?

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by shahidrasul
            i have two problem

            1. how to call a javascript function from form page and also how to call c# function from javascript because when user click on button i want to validate field of form and if validation is correct then call to c# function .
            please any no about this reply

            2. in second i have button when i click on button a calender shown and i collect date but problem is when i click on button i page reload , i want to stop reloading of page

            in coding i set the value of calender visible true
            please any body no about answer reply me
            The article named how to check if a textbox contains a number contains information on how to use JavaScript in an asp.net application.

            As for the validation, if your Server Code does the validation, you will need to do an Ajax call to the server. Consider using both server side and client side validation. Client side validation can be achieved by using controls like the RequiredFieldVa lidator, RegualarExpress ionValidator, CustomValidator ...etc.


            As for your calendar issue.
            The Calender requires a postback to the server (each date is actually a link button). To keep the Whole page from updating place the calendar control into an UpdatePanel. The update panel will do an asynchronous call to the server and only that section of the page will be updated when the page is returned to the browser.

            If you start using Ajax in your site it will become smoother, however the above mentioned article on how to include JavaScript into your page will have to be modified to use the ScriptManager in order to register your scripts...other wise they will not work properly after a postback has occurred.

            Use the MSDN Library to research the controls I've mentioned here...give it a try...and when you have more specific problems with implementation get back to us.

            -Frinny

            Comment

            • Frinavale
              Recognized Expert Expert
              • Oct 2006
              • 9749

              #7
              Please do not Double Post your question.
              I have merged your two threads since you have received help in both of them.

              Take the time to look over the posting guidelines. Following these guidelines will get your question answered more quickly and easily.

              -Moderator Frinny

              Comment

              • shahidrasul
                New Member
                • Aug 2008
                • 18

                #8
                Thanks every body help me .

                now i decide to using ajax in my project

                Comment

                Working...