Passing parameters between asp.net webforms using PreviousPageType

arraddyquop

New Member
I am trying to pass a few parameters between two web pages within the source page I have the following properties\[code\] private string _testString { get; set; } public string TestString { get { return _testString; } }\[/code\]In previous msdn examples the return type was always set to a UI element (\[code\]textbox.text\[/code\])However I am trying to pass the value from a dynamically generated link button which is why I chose to use the private accessorIn the click event of the link button on the source page I have the following:\[code\] protected void RenderReportInNewPage(LinkButton lb) { _testString = lb.CommandArgument.ToString(); Response.BufferOutput = true; Response.Redirect("~/stuff/testviewer.aspx"); }\[/code\]On the target page I have the source page referenced in the aspx as follows:\[code\]<%@ PreviousPageType VirtualPath="~/stuff/testviewer.aspx"%>\[/code\]And then in the codebehind of the target page I have the following:\[code\]Textbox.Text = PreviousPage.TestString;\[/code\]PreviousPage displays the public property TestString but it is always null (as I don't think it is getting set but not sure why)Is is possible to set a private accessor (_teststring) and have that value reflected within the public property? I'd appreciate any suggestions on what I have done wrong.-Cheers
 
Back
Top