I am fairly new to .NET, although I've had about 1.5 years experience with Classic ASP. I am rather embarressed to be having this problem, and have already wasted more than 2 days trying to get it running.
I am using a Infragistics Menu component as the menu in my app. I need to use this in several levels of folders, so I thought that I would make it a Web User Control. My impression was that this would be like an include file with a control in it. I can get this to work for 1 level, but for some reason, I can't figure out how to properly use the virtual paths here. If I use / for root, it goes all the way back to instead of my application root. If I write out the whole path, I will have to make a seperate header file for each folder.
The part that has me truly baffled is that I cannot even seem to use the application variable that we have set up in our global.asa (Application("AppPath"). When I do this, I get the error:
It is supposed to add the menu to the page.
I even tried using the application var <%=Application("App_Path"%> in a totally seperate html file and got the same error. This was a simple reference to an image folder, and was not included into the ascx file in any way at all. It simply won't allow me to use these tags at all in those two files.
Am I missing something really obvious? Could this have anything to do with my file names? (Header.ascx and Header.html?) Is there any other way at all to refer to the root of my project? I would really appreciate any help that anyone can provide, as I am at a standstill here. Thanks,
Jen
I am using a Infragistics Menu component as the menu in my app. I need to use this in several levels of folders, so I thought that I would make it a Web User Control. My impression was that this would be like an include file with a control in it. I can get this to work for 1 level, but for some reason, I can't figure out how to properly use the virtual paths here. If I use / for root, it goes all the way back to instead of my application root. If I write out the whole path, I will have to make a seperate header file for each folder.
The part that has me truly baffled is that I cannot even seem to use the application variable that we have set up in our global.asa (Application("AppPath"). When I do this, I get the error:
Code:
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
</code]
The code that triggers this is:
[code]
Line 124: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 125: Me.Controls.Add(Me.Page.LoadControl("../Includes/Header.ascx"))
It is supposed to add the menu to the page.
I even tried using the application var <%=Application("App_Path"%> in a totally seperate html file and got the same error. This was a simple reference to an image folder, and was not included into the ascx file in any way at all. It simply won't allow me to use these tags at all in those two files.
Am I missing something really obvious? Could this have anything to do with my file names? (Header.ascx and Header.html?) Is there any other way at all to refer to the root of my project? I would really appreciate any help that anyone can provide, as I am at a standstill here. Thanks,
Jen