Wrox Programmer Forums
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 27th, 2007, 03:05 PM
Registered User
 
Join Date: Dec 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to hsucp2p
Default Refresh problem


I am working on a page in .net 1.1, where post data is used at the beginning to retrieve the ID from the database using a dropdownlist. One of the .net server controls on the page is to link to another page using asp:linkbutton and the other control is to link back to the original page using asp:hyperlink with javascript: history.go(-1). The message, "The page cannot be refreshed without resending the information, Click Retry to send the information again, or click Cancel to return to the page that you were trying to view." is received when I clicked on the hyperlink back to the previous page.

There is another page on the same site. It has almost the same functionalities. It has no problem to go back to the previous page. I checked all possible causes in both html page and code behind. I couldn't find any difference between these two pages.

I would appreciate if some one can help me out on this.

Ching
 
Old December 28th, 2007, 12:55 AM
Friend of Wrox
 
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

If you want to load same page, on item change in the dropdown list. Click on dropdown in property page you may find postback property. Set it true. so whenever user changes item page will reload.

urt
 
Old December 28th, 2007, 09:59 AM
Registered User
 
Join Date: Dec 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to hsucp2p
Default

Hi urt,

The problem was not autopostback on the dropdown list. The problem was the asp:hyperlink. I received the refresh error message when I clicked on the hyperlink and tried to link it back to previous page. Any suggestions? Thanks.

Ching

 
Old December 29th, 2007, 02:48 PM
Friend of Wrox
 
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

Could you post your code and error message?

urt
 
Old January 3rd, 2008, 05:01 PM
Registered User
 
Join Date: Dec 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to hsucp2p
Default

Hi urt,
Sorry for the late response. My code is as the followings. There are two pages, WebForm1.aspx and WebForm2.aspx. I received an error message "Warning: Page has expired, The page you requested was created using information you submitted in a form...." if I selected one of those selections in the dropdown box and clicked on the link button "View WebForm2 then clicked on "Return to WebForm1" on WebForm2. In order to link it back to the previous page, WebForm1 successfully, the solutions are either I remove HTML Input (I can't do that for business reason) or I remove autopostback in the dropdown box. (I might do that if it is the only solution). So, my question is how I can clear the postback in window.history or change the page id or something in window.history. Thanks.

WebForm1.aspx
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="PageHasExpired.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        .....
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <div>
                <tr>
                    <td><asp:hyperlink id="hypReturn" NavigateUrl="javascript: window.history.go(-2)" CssClass="hyplink"
                            Runat="server">< Return to WebForm1</asp:hyperlink></td>
                </tr>
                <br>
                <br>
                <tr>
                <td><asp:dropdownlist id="ddlTrialBatchPoint" runat="server" AutoPostBack="True">
                            <asp:ListItem>Select one</asp:ListItem>
                            <asp:ListItem>1</asp:ListItem>
                            <asp:ListItem>2</asp:ListItem>
                            <asp:ListItem>3</asp:ListItem>
                            <asp:ListItem>4</asp:ListItem>
                        </asp:dropdownlist></td>
                </tr>
                <br>
                <br>
                <tr>
                    <td>
                        <asp:LinkButton id="lnkViewPage2" onclick="lnkViewPage2_Click" runat="server" CssClass="hyplink">View WebForm2</asp:LinkButton></td>
                </tr>
                <br>
                <br>
                <tr>
                    <td>
                        <input id="fileName" type="file" size="20" runat="server"></td>
                    <td><asp:requiredfieldvalidator id="reqFileName" runat="server" ErrorMessage="* File name Required" EnableClientScript="False"
                            ControlToValidate="fileName"></asp:requiredfieldvalidator></td>
                </tr>
            </div>
        </form>
    </body>
</HTML>

WebForm1 code behind:
private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
        }

        protected void lnkViewPage2_Click(object sender, System.EventArgs e)
        {
            Server.Transfer("WebForm2.aspx");
        }

WebForm2.aspx
<form id="Form1" method="post" runat="server">
            <div>
                <tr>
                    <td><asp:hyperlink id="hypReturn" Runat="server" NavigateUrl="javascript: window.history.go(-1)">< Return to WebForm1</asp:hyperlink>
                    </td>
                </tr>
                <tr>
                    <td><p><b>Page 2 data.</b></p>
                    </td>
                </tr>
            </div>
        </form>

WebForm2 - no code behind.

ching

 
Old January 4th, 2008, 01:15 AM
Friend of Wrox
 
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

simply if you want to reload previous page, then do not user history.go,
instead create hyperlink refereing previous page with complete query string if any.

<a href="previouspage.aspx?par1=val1&par2=val2">Back</a>


urt
 
Old January 4th, 2008, 07:02 PM
Registered User
 
Join Date: Dec 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to hsucp2p
Default


Thank you for your suggestion. Ching






Similar Threads
Thread Thread Starter Forum Replies Last Post
Still the "Refresh problem" ... fskilnik Dreamweaver (all versions) 10 October 20th, 2005 11:25 AM
ASP Refresh problem MDrumm BOOK: Beginning ASP 3.0 2 May 25th, 2005 11:01 AM
Refresh Problem gkirk Beginning PHP 2 February 25th, 2005 04:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.