Posting Back Page with javascript

Discussion in 'ASP .Net' started by The Crow, Sep 8, 2005.

  1. The Crow

    The Crow Guest

    i have a popup window that is basically a save form, it opens from a page
    that contains datagrid for listing records.. when save button is clicked
    from popup window, i want to refresh listing page, so newly added record
    would appear in the grid. i am able to access parent window, can call
    functions, even submit the page. but i want to be able a server-side
    function invoked also. even in the page_load routine being able to figure
    out a refresh request is given is enough. any suggestions?
     
    The Crow, Sep 8, 2005
    #1
    1. Advertising

  2. When you submit the page, it is a postback. You can detect it with the
    IsPostBack property in the page_load event.

    Eliyahu

    "The Crow" <q> wrote in message news:...
    > i have a popup window that is basically a save form, it opens from a page
    > that contains datagrid for listing records.. when save button is clicked
    > from popup window, i want to refresh listing page, so newly added record
    > would appear in the grid. i am able to access parent window, can call
    > functions, even submit the page. but i want to be able a server-side
    > function invoked also. even in the page_load routine being able to figure
    > out a refresh request is given is enough. any suggestions?
    >
    >
     
    Eliyahu Goldin, Sep 8, 2005
    #2
    1. Advertising

  3. The Crow

    The Crow Guest

    there are lots of other controls that posts back too. i want to be able to
    know that just a grid refresh needed. i found a solution but i think its
    not so elegant. i call __doPostBack("RefreshPage", ""); from javascript and
    check in the Page_Load routine :
    bool refreshPage = Request.Form["__EVENTTARGET"] == "RefreshPage";

    i could do it with __doPostBack("", "RefreshPage"); and ["__EVENTARGUMENT"]
    == "RefreshPage"

    i tried
    Page.GetPostBackEventReference(this, "RefreshPage");

    it writes __doPostBack("", "RefreshPage");

    and in the page i override RaisePostBackEvent :



    protected override void RaisePostBackEvent(IPostBackEventHandler
    sourceControl, string eventArgument)

    {

    if(eventArgument == "RefreshPage")

    {

    //Do something..

    }

    base.RaisePostBackEvent (sourceControl, eventArgument);

    }



    but this method doesnt be called by the asp.net..

    it is suprising that no elegant solution is provided by microsoft..
     
    The Crow, Sep 8, 2005
    #3
  4. I usually have a hidden input control where I pass from client to server an
    action code like "RefreshPage".

    Eliyahu

    "The Crow" <q> wrote in message
    news:O9qma$...
    > there are lots of other controls that posts back too. i want to be able to
    > know that just a grid refresh needed. i found a solution but i think its
    > not so elegant. i call __doPostBack("RefreshPage", ""); from javascript

    and
    > check in the Page_Load routine :
    > bool refreshPage = Request.Form["__EVENTTARGET"] == "RefreshPage";
    >
    > i could do it with __doPostBack("", "RefreshPage"); and

    ["__EVENTARGUMENT"]
    > == "RefreshPage"
    >
    > i tried
    > Page.GetPostBackEventReference(this, "RefreshPage");
    >
    > it writes __doPostBack("", "RefreshPage");
    >
    > and in the page i override RaisePostBackEvent :
    >
    >
    >
    > protected override void RaisePostBackEvent(IPostBackEventHandler
    > sourceControl, string eventArgument)
    >
    > {
    >
    > if(eventArgument == "RefreshPage")
    >
    > {
    >
    > //Do something..
    >
    > }
    >
    > base.RaisePostBackEvent (sourceControl, eventArgument);
    >
    > }
    >
    >
    >
    > but this method doesnt be called by the asp.net..
    >
    > it is suprising that no elegant solution is provided by microsoft..
    >
    >
     
    Eliyahu Goldin, Sep 8, 2005
    #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. alanb
    Replies:
    2
    Views:
    575
    alanb
    Apr 23, 2004
  2. Rick

    page is not posting back

    Rick, Oct 18, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    313
    ESPN Lover
    Oct 19, 2004
  3. Jacob
    Replies:
    4
    Views:
    587
    Jacob
    Jul 7, 2003
  4. GoCMS
    Replies:
    2
    Views:
    398
    GoCMS
    Sep 19, 2006
  5. Jacob
    Replies:
    4
    Views:
    116
    Jacob
    Jul 7, 2003
Loading...

Share This Page