Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 09, 2011 10:54 AM by dareddy
Jun 20, 2005 10:44 PM|LINK
Control ctrl = FindControl("Note1");
if(ctrl is ItemNotes)
It work fine in ASP.NET 1.1 but doesn't compile in 2.0 and i don't see control class in assigned namespace. By default, this class is in App_Code directory and is a base class for other controls.
Is there any way to handle this?
Jun 21, 2005 03:05 AM|LINK
A workaround is to make ItemNotes a simple class that is derived from UserControl, and then create a separate user control that derives from ItemNotes and use that in the pages.
You can add all the properties/methods that you need to the ItemNotes class (possibly making them virtual or even abstract) and then implement them as needed in the deriving user control class.
This gives you
public class ItemNotes : UserControl
partial class ItemNotesControl : ItemNotes
Jun 21, 2005 04:47 PM|LINK
Jun 21, 2005 10:08 PM|LINK
Jun 21, 2005 10:40 PM|LINK
I can add a reference to a page or another control. But i was trying to access it from a base class file derived from UserControl. This class file is in App_Code directory and working as a base class for other user controls. there were no problems in derived
controls. I cannot access any page or User control in App_Code folder classes. It doesn't compile.
I found another solution as i replied to DMW.
Jun 24, 2005 05:36 PM|LINK
Sep 09, 2011 10:54 AM|LINK
in App_code i have a commompage.vb class file and in main solution i have a user control(.ascx).i need to access this user contol into my commonpage.vb class..plz help me out this issue.give a example...