Reputation: 243
I am trying to pass a value between two pages. However on my target page, the value is not found.
My source page includes the following code.
Public ReadOnly Property SQLString() As String
Get Return "SELECT * FROM City" End Get End Property
On my target aspx page I have included the following directive:
<%@ PreviousPageType VirtualPath="~/tools/SearchResults.aspx"%>
In the target page code behind I have included the following in the page load:
Me.Master.Page.PreviousPage.SQLString
However, Visual studio complains that, SQLString is not a member of System.Web.Ui.page.
I must note I am useing master pages, and vaguely recall this causing an issue when accomplishing this in the past. Anyone have any ideas?
Upvotes: 0
Views: 241
Reputation: 5543
You need to cast the page to whatever type it actually is.
CType(Me.Master.Page.PreviousPage, ActualPageType).SqlString
In the code behind of your source page you will have a class declaration like the following:
Public Class ActualPageType
Inherits Page
Upvotes: 1