views:

23

answers:

1

If I use a Server.Transfer command with a true value passed for the "PreserveForm" 2nd param's value:

Default.aspx:

  Server.Transfer("WebForm1.aspx", True)

...I can access the value of the textbox "TextBox1" control on the first page, Default.aspx, from "WebForm1.aspx" as follows:

 lblPassedValue.Text = Request.Form("ctl00$MainContent$TextBox1")

I know that I can control the way that IDs are generated in Visual Studio 2010, but how about controlling the NAME property?

I would like it to read:

 lblPassedValue.Text = Request.Form("TextBox1")

I'd also rather use ASP.NET Textbox controls rather than a native HTML textbox.

A: 

Server.Transfer("Page.aspx", True)

On Page.aspx:

<%@ PreviousPageType VirtualPath="~/SenderPage.aspx" %>

Dim Test = CType(Me.PreviousPage.FindControl("TextBox1"), TextBox).Text
diamandiev