T
The Crow
i want to raise an event on the server with a javascript call on the client.
i found a solution but i think its not so elegant. the solution is:
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 could also add a hidden input control to the form, and set its value to
something and check its value in the Page_Load event handler..
i also tried
Page.GetPostBackEventReference(this, "RefreshPage");
it writes out : __doPostBack("", "RefreshPage");
i called that function in javascript to cause an postback and in the page i
overrode the RaisePostBackEvent method:
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. does
anybody know better way doing this?
i found a solution but i think its not so elegant. the solution is:
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 could also add a hidden input control to the form, and set its value to
something and check its value in the Page_Load event handler..
i also tried
Page.GetPostBackEventReference(this, "RefreshPage");
it writes out : __doPostBack("", "RefreshPage");
i called that function in javascript to cause an postback and in the page i
overrode the RaisePostBackEvent method:
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. does
anybody know better way doing this?