CrossPost access to data
        Posted  
        
            by Craig
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Craig
        
        
        
        Published on 2010-05-09T11:47:15Z
        Indexed on 
            2010/05/09
            11:58 UTC
        
        
        Read the original article
        Hit count: 613
        
Hi,
I have a search form on a page that posts back to itself and shows the results, all works fine. I now have a requirement to put the same search form on the site home page. This needs to post back to the search form and run the findResults code. Using the PostBackURL parameter on the home page form's submit button I can hit the search page ok. However, when using the following code in the Page_Load section of the search page I hit the problem of not being able to access data from the posting page as I get the following error message on the line starting "yearList.SelectedValue....": "'Site._default1.Protected WithEvents yearList As System.Web.UI.WebControls.DropDownList' is not accessible in this context because it is 'Protected'".
  '#################################
  '# Handle form post from Home page
  '#################################
  Dim crossPostBackPage As Site._default1
  If Not (Page.PreviousPage Is Nothing) Then
   If Not (Page.IsCrossPagePostBack) Then
    If (Page.PreviousPage.IsValid) Then
     crossPostBackPage = CType(PreviousPage, Site._default1)
     yearList.SelectedValue = crossPostBackPage.yearList.SelectedValue
     getAvailability()
    End If
   End If
  End If
As I didn't declare yearList Protected, I don't know where to change it or how to.
Any advice would be appreciated,
Craig
© Stack Overflow or respective owner