Moving Data

  • Thread starter Thread starter Michael Mitchell via DotNetMonster.com
  • Start date Start date
M

Michael Mitchell via DotNetMonster.com

I am creating an ASP.NET form that users will fill data in text boxes and then I need it to out put in a seperate .aspx form labels.Text(Open new page). I have the form created and put the output labels on the same page to test and it works but I can not figur out how to collect the data from the input form and have it out put on a seperate page. If some one could show me an example just using one or two text boxes collect the input and then output to a seperate page using labels for output. In my attempt I received the error: BC30469 Reference to a non-shard member requires an object reference.

Thank You Very much, Mike
 
Have you tried using Server.Transfer? One of the overloads of Server.Transfer
allows you to specify that the QueryString and Forum collections should be
preserved to the new page.

So on your submit button click event, you would have:

Server.Transfer("new_page.aspx", true);

The page "new_page.aspx" can now reference the Form collection from the
previous page - which will contain all of the text box values. Note that the
Server.Transfer does not round trip to the client so the url in the browser
will not change from original page. Hope this helps.

James Churchill
 
James, thanks for the input, i have tried server.transfer. Here is some example code, I think I didn't specify exactly what needed to be accomplished. Thanks for the quick response. If you have further input please let me know.
Thanks, mike

* I need to collect the input data on exampl1.aspx by hitting the review button.
* Out put the data in the corresponding Labels on Example2.aspx.
* Save Example2.aspx to a File of the users choice when the save button is clicked
* I USE WebMatrix

Example1.aspx:
<%@ Page Language="VB" %>
<script runat="server">

'I have tried all kinds of things:
'Server.Transfer("Example2.aspx", True)

</script>
<html>
<head>
</head>
<body>
<form runat="server" ID="frmForm1">
<p>
&nbsp;
</p>
<p>
<asp:Label id="lblFirstName" runat="server">First Name</asp:Label>
<asp:TextBox id="txtFirstName" runat="server"></asp:TextBox>
</p>
<p>
<asp:Label id="lblLastName" runat="server">Last Name</asp:Label>
<asp:TextBox id="txtLastName" runat="server"></asp:TextBox>
</p>
<p align="left">
<asp:Button id="btnReview" runat="server" Text="Review"></asp:Button>
</p>
<!-- Insert content here -->
</form>
</body>
</html>

Example2.aspx:
<%@ Page Language="VB" %>
<script runat="server">



</script>
<html>
<head>
</head>
<body>
<form runat="server" ID="frmForm2">
<p>
&nbsp;
</p>
<p>
First&nbsp;Name is:
<asp:Label id="lblFirstName" runat="server"></asp:Label>
</p>
<p>
Last Name is:<asp:Label id="lblLastName" runat="server"></asp:Label>
</p>
<p>
<asp:Button id="btnSave" runat="server" Text="Save"></asp:Button>
</p>
<!-- Insert content here -->
</form>
</body>
</html>
 
Back
Top