Click here to Skip to main content
15,883,744 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The page is not PostBack.Please check out the error...

Transferring_Information1.aspx

XML
<div>

<asp:Button runat="server" ID="cmdPost" PostBackUrl="~/Topics/Transferring Information/Transferring_Information2.aspx"
            Text="Cross-Page Postback" /><br />
</div>



Transferring_Information2.aspx

XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Transferring_Information2.aspx.cs" Inherits="Topics_Transferring_Information_Transferring_Information2" %>
<%@ PreviousPageType VirtualPath="~/Topics/Transferring Information/Transferring_Information1.aspx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="lblInfo" runat="server" Text="Label"></asp:Label>
    </div>
    </form>
</body>
</html>


Transferring_Information2.aspx.cs

C#
protected void Page_Load(object sender, EventArgs e)
    {
        if (PreviousPage != null)
        {
            lblInfo.Text = "You came from a page titled " +PreviousPage.Title + "<br />";
        }
    }
Posted
Comments
Ciumac Sergiu 8-Jun-11 3:52am    
If the PostBackUrl is correct I see no problem of why it shouldn't work.

hi,
If there is any validation in Transferring_Information1.aspx page
then put CauseValidation
XML
<asp:Button runat="server" ID="cmdPost" CauseValidation="false" PostBackUrl="~/Topics/Transferring Information/Transferring_Information2.aspx"
            Text="Cross-Page Postback" />

Another reason might be Redirection URL, remove the extra space and rename the directory accordingly and try again, i.e. rename Transferring Information to TransferringInformation and use this code below,
VB
<asp:Button runat="server" ID="cmdPost" CauseValidation="false"
PostBackUrl="~/Topics/TransferringInformation/Transferring_Information2.aspx"
Text="Cross-Page Postback" />

Hope this will help.
 
Share this answer
 
Comments
sat_100m 10-Jun-11 12:58pm    
Thnx..............
XML
<asp:button id="Button2"
      text="Post value to another page"
      postbackurl="Button.PostBackUrlPage2vb.aspx"
      runat="Server">
    </asp:button>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900