2.0: "Page cannot be refreshed without sending information again."

R

R.A.M.

Hello,
I have written an .aspx page which calls Calendar.aspx page to select
birth date which should be assign to some text box control on first
page.
Here's the code of first page:

Birthdate: <asp:TextBox ID="Birthdate" runat="server"
ValidationGroup="Birthdate" />
<asp:Button ID="Calendar" runat="server"
Text="Calendar"
OnClientClick="window.open('Calendar.aspx');" />
....
public partial class WWWPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Birthdate from calendar:
if (Session["Birthdate"] != null)
Birthdate.Text = (string) Session["Birthdate"];
}
....

Here's Calendar.aspx.cs:

....
public partial class CalendarPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session["Birthdate"] = null;
}
protected void Calendar_SelectionChanged(object sender,
EventArgs e)
{
Session["Birthdate"] =
Calendar.SelectedDate.ToString().Substring(0, 10);
}
}


After Calendar page is used and closed I cannot see retrieved date
because I got a message (I translated it to English, my language is
Polish):
"Page cannot be refreshed without sending information again. Press
button 'Try again' or press button 'Cancel', to return to page which
you wanted to view."
After pressing 'Try again' I see what I wanted but don't need this
message box. Could you explain me what's going on and tell me how to
correct it?
Thank you very much.
/RAM/
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

The first page is a result of a POST request (probably a postback), so
the request that got the page contains form data. When the popup reloads
the first page, the form data will be sent to do the same request that
got the page before, but not without informing the user that the reload
will post form data.

To avoid this you can:

:: Make sure that the first page is a result of a GET, not a POST.

:: Make the popup page cause a postback of the first page to reload it.

:: Make the popup page use a GET (set window.location) to update the
first page.
 

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,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top