469,592 Members | 2,041 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

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

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/
May 10 '06 #1
1 2697
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.

R.A.M. wrote:
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/

May 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Matt | last post: by
reply views Thread by Svetlana Syrkin | last post: by
2 posts views Thread by Richard Morey | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.