1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Call server side events and functions from Javascript

Discussion in 'ASP' started by naimish, Sep 1, 2009.

  1. naimish

    naimish New Member

    Joined:
    Jun 29, 2009
    Messages:
    1,046
    Likes Received:
    18
    Trophy Points:
    0
    Occupation:
    Software Engineer
    Location:
    On Earth

    Introduction



    To call server side events and functions from client side javascript function in asp.net.

    Suppose we want to perform both client side and server side activities for an event,we can use this logic

    Background



    Three are 2 ways to acheive this functionality.

    one using __dopostback() and another using form.submit(). Say you are having a client side javascript function named clientfunction. From clientfunction if u want to call any serverside function or serverside event(eg: dropdown selected index change) say server function and serverdropdown.

    The code




    Code:
    function clientfunction
    {
    	//do the client side validations here
    	//
    	//now call the server side dropdown event explicitly
    	__doPostBack('cboserverdropdown','');
    }
    
    Code:
    function clientfunction
    {
    	//do the client side validations here
    	//
    	//or just give below code
    	form.submit();
    }
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    This works only for ASP.net, if there any way to this in other languages like PHP?
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
  4. djbrown

    djbrown New Member

    Joined:
    Oct 22, 2009
    Messages:
    16
    Likes Received:
    1
    Trophy Points:
    0
    This works only for ASP.net?
     
  5. technica

    technica New Member

    Joined:
    Dec 15, 2007
    Messages:
    107
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    I am looking for the way to do this in classic asp 3.0 language. If you know how to do it then please post article for that too. By the way this article is good.
     

Share This Page