throw an application wide event in an asp.net page

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

Alvin Bruney

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")
 
G

Guest

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?


.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top