G
Guest
Hi,
I have got a User Control that contains for the sake of argument, a single
DataList control.
eg.
<asp
ataList id="DataListMain" runat="server" RepeatDirection="Horizontal"
RepeatColumns="4"
Width="100%" GridLines="Vertical">
<ItemTemplate>
asdf
</ItemTemplate>
</asp
ataList>
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 user
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 my UserControl.
A NullReferenceException is obviously thrown when trying access the reference.
eg.
private void Page_Load(object sender, System.EventArgs e)
{
this.DataList1.DataSource = <some datasource>; // this is where
DataList1 == <undefined>
}
I must be missing something yeah?
Please help
I have got a User Control that contains for the sake of argument, a single
DataList control.
eg.
<asp
RepeatColumns="4"
Width="100%" GridLines="Vertical">
<ItemTemplate>
asdf
</ItemTemplate>
</asp
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 user
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 my UserControl.
A NullReferenceException is obviously thrown when trying access the reference.
eg.
private void Page_Load(object sender, System.EventArgs e)
{
this.DataList1.DataSource = <some datasource>; // this is where
DataList1 == <undefined>
}
I must be missing something yeah?
Please help