blitzkrieg bop Posted October 25, 2003 Posted October 25, 2003 Newbie question: I Created two ascx file with the code of my old header.asp and footer.asp and put them in my products.aspx page like this: Under <%@ Page %> <%@ Register TagPrefix="Module" TagName="Header" Src="Header.ascx" %> <%@ Register TagPrefix="Module" TagName="Footer" Src="Footer.ascx" %> And set the usercontrols in the html part of the aspx page where I wanted to show <MODULE:HEADER id="Header" runat="server"></MODULE:HEADER> <MODULE:FOOTER id="Footer" runat="server"></MODULE:FOOTER> that works but I have a problem. I have a variable called dbCustID that I set in my old header.asp and I used it in footer.asp. Now I get an error in footer.ascx that says "Name 'dbCustID' is not declared." So I thought that if I added this to the top of header.ascx it would work: <script language="VB" runat="server"> Public dbCustID As String = "test" </script> No good. How can I access dbCustID which is set in header.ascx from footer.ascx? Thanks Quote
*Gurus* Derek Stone Posted October 25, 2003 *Gurus* Posted October 25, 2003 You can't. Not directly anyway, since the variables are out of scope. It would be much more appropriate to set the variable in the page and pass it to the user controls that require it via properties. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.