Posting Back Page with javascript

T

The Crow

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?
 
E

Eliyahu Goldin

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

Eliyahu
 
T

The Crow

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..
 
E

Eliyahu Goldin

I usually have a hidden input control where I pass from client to server an
action code like "RefreshPage".

Eliyahu
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top