2.0: accessing user-defined controls

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/
 
N

newscorrespondent

Go back to your definition of the control and make sure the components you
want to access are not private.
 
M

Mark Rae

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top