2.0: accessing user-defined controls

  • Thread starter Thread starter RAM
  • Start date Start date
R

RAM

Hello,
I am learning .NET. I defined my own control:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Header.ascx.cs"
Inherits="HeaderDoc" %>
<asp:TextBox ID="Year" runat="server" /><br />
....
and I used it on a second page:

<%@ Register TagPrefix="MIMStock" TagName="Header" Src="~/Header.ascx" %>
.... <MIMStock: ID="Header" runat="server" />

Now I would like to access elements of Header in code behind of the second
page:

Header.Year.Text = "..."

But it doesn't compile. How to do it?
Please help.
Thank you!
/RAM/
 
Go back to your definition of the control and make sure the components you
want to access are not private.
 
But it doesn't compile.

There's no point saying something like "But it doesn't compile" unless you
tell us *why* it doesn't compile! What is the error message, etc?

I wrote some code this morning but it didn't work - can you help me?
 
Back
Top