My project name is sbmanager and in that project I have a page named mgrGridHome.aspx This page has the following reference:
<%@ Page Language="C#" Inherits="sbmanager.mgrGridHome" MasterPageFile="~/masterpages/global.master" %>
That has a label on it:
<asp:Label id="lblCurrentTime" runat="server"></asp:Label>
In my mgrGridHome.aspx.cs file I have the following:
protected void page_load(object sender, EventArgs e)
{
lblCurrentTime.Text = "See Me";
}
But when I compile and run the page the label value is not set as if the page load has not fired.
But if I place the same code directly on the page like this:
<script language="C#" runat="server">
public void Page_Load(object sender, EventArgs e)
{
<asp:Label id="lblCurrentTime" runat="server"></asp:Label>
}
</script>
The label value is set.
All I want to do is set the label value when the page loads. At the moment I don't care if it is a post-back or not. Am I going about this the wrong way?
Moved from Comment -
<%@ Page AutoEventWireup="true" ... %>
Page_Load