Problem with User Control and unset references to controls within

S

Sam Martin

Hi,

I have got a User Control that contains for the sake of argument, a single
DataList control.

eg.
<asp:DataList id="DataList1" runat="server" RepeatDirection="Horizontal"
RepeatColumns="4"
Width="100%" GridLines="Vertical">
<ItemTemplate>
asdf
</ItemTemplate>
</asp:DataList>

VS.NET 2003 automatically puts in the code behind:

protected System.Web.UI.WebControls.DataList DataList1;

in the Page_Load event of the control, this.DataList1 is always undefined.

I've tried this again with other controls, created new really simple test
control to see if the same thing happens, and it does. I can't seem to be
able to get a reference to the Web Control held within the UserControl.

I must be missing something yeah?

Please help
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top