Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / March 2006

Tip: Looking for answers? Try searching our database.

Problem with User Control and unset references to controls within

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sam Martin - 30 Mar 2006 15:26 GMT
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

Signature

TIA
Sam Martin

Steve C. Orr [MVP, MCSD] - 30 Mar 2006 20:03 GMT
Try changing the declaration from "protected" to "public".
Here's more info:
http://SteveOrr.net/faq/PassDataToUserControl.aspx

Signature

I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

> Hi,
>
[quoted text clipped - 23 lines]
>
> Please help

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.