Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page_load not triggered in popup

Status
Not open for further replies.

Miclis

Programmer
Jan 27, 2005
14
0
0
NO
I open a Dialog/popupwindow when I click on a button:
string popupScript= "<script language='javascript'>" +
"window.showModalDialog('MyDialog.aspx', null, " +
"' DialogHeight=300px; DialogWidth=600px;')" +
"</script>";
Page.RegisterStartupScript("PopupScript", popupScript);

In MyDialog.aspx in the Page_load I have:
Label1.Text=DateTime.Now.ToLongTimeString();

This works fine.
But... next time I open the Dialog, Label1 still shows the time from the first time I clicked on it.

What to do? Why is Page_load not triggered?
 
Is it using the same window twice? That's what it sounds like to me...try opening it the second time, then refreshing...may be updated.
 
Thanks for your reply!

Yes, I suppose it's using the same window twice.
How can you change this?

I tried to refresh the popupwindow, but how and where?
 
No, I'm sorry, disable viewstate for the label doesn't help.
 
Wait...something doesn't jive.

You say that you're opening up the modal dialog from a button, but the code you posted will fire when the page loads...Can you post the actual code you're using for the button?

D
 
I click on a button:

private void Button1_Click(object sender, System.EventArgs e)
{
string popupScript= "<script language='javascript'>" +
"window.showModalDialog('MyDialog.aspx', null, " +
"' DialogHeight=300px; DialogWidth=600px;')" +
"</script>";
Page.RegisterStartupScript("PopupScript", popupScript)
}

Then my popupwindow opens. In the Page_Loads I have:

private void Page_Load(object sender, System.EventArgs e)
{
Label1.Text=DateTime.Now.ToLongTimeString();
}

This works fine.
But... next time I open the Dialog, Label1 still shows the time from the first time I clicked on it.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top