throw an application wide event in an asp.net page

  • Thread starter Thread starter PrashanthNagaraj
  • Start date Start date
P

PrashanthNagaraj

How to throw an event in an asp.net page and handle that
event on another page such that the page where the event
is handled is posted back to the server in response to the
event. For Example if I click a button in a.aspx page ,
b.aspx page should pop out in a different window and if I
select a text from a listbox in b.aspx then how do iI
close b.aspx and render the selected text(in b.aspx) to a
text box in a.aspx?
 
Good programming practice mandates that objects thrown be associated with
exceptions or runtime anomalies. Attempting to throw an event works contrary
to this standard, subverts the exception mechanism and makes code
maintainability and re-use unnecessarily difficult.

If what you want to do is pop out windows, I suggest you use a combination
of javascript window.open(b.aspx) to call the other page and caching,
context object or query string parameters to pass values between pages.

In your case you would do this from a.aspx
[snip]
session["value"] = myValue;
Response.Write("<script>window.open('b.aspx')</script>");

In b.aspx page _ load
if(session["value"] != null)
{
string val = session["value"]
}

regards

Server.Transfer("b.aspx")
 
Prashanth,

You can also use simple JavaScript to satisfy your
requirement.
-----Original Message-----
Good programming practice mandates that objects thrown be associated with
exceptions or runtime anomalies. Attempting to throw an event works contrary
to this standard, subverts the exception mechanism and makes code
maintainability and re-use unnecessarily difficult.

If what you want to do is pop out windows, I suggest you use a combination
of javascript window.open(b.aspx) to call the other page and caching,
context object or query string parameters to pass values between pages.

In your case you would do this from a.aspx
[snip]
session["value"] = myValue;
Response.Write("<script>window.open('b.aspx')</script>");

In b.aspx page _ load
if(session["value"] != null)
{
string val = session["value"]
}

regards

Server.Transfer("b.aspx")

--


-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
How to throw an event in an asp.net page and handle that
event on another page such that the page where the event
is handled is posted back to the server in response to the
event. For Example if I click a button in a.aspx page ,
b.aspx page should pop out in a different window and if I
select a text from a listbox in b.aspx then how do iI
close b.aspx and render the selected text(in b.aspx) to a
text box in a.aspx?


.
 
Back
Top