I am a PHP programmer. I'm used to using an include command and all the code on that page executes, wherever I put it on the page. I am having a slightly different experience with ASP.NET. I've only been using it for less than a year and let's just say it's not my "language of choice", unless someone can explain how these blasted includes work....
Attached is some code to show what I was doing, which I thought was working, but apparently is not... I'm pretty sure the .vb code is not getting executed at all.
The actual file is there, however nothing in the codebehind file gets executed. I've got it all under
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
This is very frustrating. I'm not even sure that file includes are my problem. I have a section of code that either shows/hide an ASP:Panel based on an if statement. This code sits inside the header.aspx.vb file. When it's there, the page loads fine, however doesn't execute the code. I've explicitly set it to FALSE and it supposed to hide 1 panel and show another, but doesn't.
If I try to move it the main "holder" page, like default.aspx, it tells me it can't find the ASP:Panel. I would think that if I wanted to control ANYTHING, as long as I put it ABOVE the actual control, it shouldn't matter which file (there goes my PHP thinking again).
So what exactly is the best way to do this? I cannot figure this out.
'First line of Default.aspx
<%@ Page Language="VB" CodeFile="Default.aspx.vb" Inherits="_Default" %>
'This is how i thought includes work:
<%@ Register TagPrefix="atcu" TagName="header" Src="~/header.ascx" %>
'then on the page somewhere:
<atcu:header id="header1" runat="server"></atcu:header>
'this is how my header.aspx file looks:
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="header.ascx.vb" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>