How to trigger a postback from javascript

Discussion in 'ASP .Net' started by NWx, Feb 16, 2004.

  1. NWx

    NWx Guest

    Hi,

    How can I make a page to postback automatically, using JavaScript?
    I need a JavaScript function as handled to page_load, but I don't know what
    code to write to trigger postback.

    Can anyone help me?
    Regards
     
    NWx, Feb 16, 2004
    #1
    1. Advertisements

  2. NWx

    Curt_C [MVP] Guest

    formName.submit()
     
    Curt_C [MVP], Feb 16, 2004
    #2
    1. Advertisements

  3. The form has a submit method that you can call.



    --
    Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    "Programming is an art form that fights back"


    ELKNews - Get your free copy at http://www.atozedsoftware.com
     
    Chad Z. Hower aka Kudzu, Feb 16, 2004
    #3
  4. NWx

    John Oakes Guest

    Call the __doPostBack function that ASP.NET creates:
    __doPostBack(id,'');

    If you want to see an example of this check out the Time Tracker starter
    kit on www.asp.net. They do this to force a postback after selecting a date
    from a popup calendar.

    -John
     
    John Oakes, Feb 16, 2004
    #4
  5. NWx

    Teemu Keiski Guest

    Hi,

    if you want to cause the postback as if happening in behalf of another
    control (means this controls postback event is raised as well), you can use
    Page.GetPostBackEventReference to return the __doPostBack call (it returns
    it as string and you need to place that on page to be called)

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist

    Hi,

    How can I make a page to postback automatically, using JavaScript?
    I need a JavaScript function as handled to page_load, but I don't know what
    code to write to trigger postback.

    Can anyone help me?
    Regards
     
    Teemu Keiski, Feb 16, 2004
    #5
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.