Calling C#/VB.Net function in Javascript

Discussion in 'ASP .Net' started by Tanmaya Kulkarni, Jun 20, 2006.

  1. Hi,

    I have a web application where I need to call backend C#/VB.Net functions
    from javascript.

    Is it possible..and how?

    Thanks,
    Tanmaya
     
    Tanmaya Kulkarni, Jun 20, 2006
    #1
    1. Advertising

  2. Tanmaya Kulkarni

    Ankit Aneja Guest

    when is javascript function called if it is called from aspx page itself
    like we do for client side validation then it itself goes to codebehin if
    true is returned
    like
    <asp:button id="cmdsubmit" Runat="server" Text="Submit"
    OnClick="checksubmit()"></asp:button>
    then on submitting javascript function will be called and if every thing
    validates function associated with this submit button in code behind will be
    called
    function checksubmit()
    {
    if(document.generalinfo.elements["firstname"].value=="")
    {
    alert("Please enter First name ");
    return false;
    }


    if(document.generalinfo.elements["lastname"].value=="")
    {
    alert("Please enter Last name ");
    return false;
    }

    if(document.generalinfo.elements["addrline1"].value=="")
    {
    alert("please enter your Address");
    return false;
    }

    if(document.generalinfo.elements["city"].value=="")
    {
    alert("please enter your City");
    return false;
    }

    if(document.generalinfo.elements["state"].value=="")
    {
    alert("please enter your State");
    return false;
    }

    if(document.generalinfo.elements["country"].value=="")
    {
    alert("please enter your Country");
    return false;
    }

    if(document.generalinfo.elements["pin"].value=="")
    {
    alert("please enter your Pin");
    return false;
    }
    if(Validatephone()==false)
    return false;
    }

    but if ur scenario is different than i can't say

    "Tanmaya Kulkarni" <> wrote in message
    news:...
    > Hi,
    >
    > I have a web application where I need to call backend C#/VB.Net functions
    > from javascript.
    >
    > Is it possible..and how?
    >
    > Thanks,
    > Tanmaya
    >
     
    Ankit Aneja, Jun 20, 2006
    #2
    1. Advertising

  3. Tanmaya Kulkarni

    Jacob Guest

    You can do it by using callbacks in ASP.NET 2.0


    Tanmaya Kulkarni wrote:
    > Hi,
    >
    > I have a web application where I need to call backend C#/VB.Net functions
    > from javascript.
    >
    > Is it possible..and how?
    >
    > Thanks,
    > Tanmaya
     
    Jacob, Jun 20, 2006
    #3
  4. Tanmaya Kulkarni

    Guest

    use __doPostBack function of javascript
    Note: There Is two underscore "__"


    Tanmaya Kulkarni wrote:
    > Hi,
    >
    > I have a web application where I need to call backend C#/VB.Net functions
    > from javascript.
    >
    > Is it possible..and how?
    >
    > Thanks,
    > Tanmaya
     
    , Jun 20, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. szabelin
    Replies:
    6
    Views:
    14,228
    szabelin
    Aug 16, 2003
  2. Anatoly
    Replies:
    1
    Views:
    9,040
    =?Utf-8?B?TmlsZXNodw==?=
    Feb 17, 2004
  3. rahulkate
    Replies:
    0
    Views:
    16,755
    rahulkate
    Feb 26, 2004
  4. Andreas Lagemann
    Replies:
    8
    Views:
    535
    Mike Wahler
    Jan 10, 2005
  5. tiwy
    Replies:
    0
    Views:
    461
Loading...

Share This Page