Inherits user controls from my own user control.

Hi,

I am working on ASP.NET 2.0 with the C# as code behind.

I have a baseControl.ascx.cs which will have properties and some methods.Then I have childControl.ascx.cs which inherits from  the baseControl.

Public partial class childControl : baseControl

Both user controls are in the same namespace. When I build those user controls, it returns me error saying that the type or namespace baseControl cannot be found().

I would like to know is it possible to inherit user control? Will it be possible if I declared the baseControl as an abstract class since I want to have some abstract methods in that class?

Thanks.

 


 

0
Tee_Fish
1/3/2006 3:12:00 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

1 Replies
948 Views

Similar Articles

[PageSpeed] 32
Get it on Google Play
Get it on Apple App Store

That's due to the new Web Project scheme in ASP.NET 2.0.  I
haven't quite figured it out entirely but I do know of one quick way if
you don't need to define a template for your user control.  Create
a new class that inherits from User Control(as a pure CS file...not as
a User Control you selected to add a new item) and put it in the
App_Code folder(create it if you haven't yet...it's a default ASP.NET
folder you can select).  Put all of the base control logic
there.  The base class should now be accessible to your user
controls.  

But that's only if your base control doesn't define any template...

0
tetsujin
1/3/2006 4:30:36 AM
Reply:

Similar Artilces:

Web User Control to Web User Control...
Hi, I have 2 User controls on a page and want Control1 to call a method of Control2. Is this Possible? Example: Con1 = Datalist showing products, each with a Quantity Box and a Button. Con2 = Repeater showing Cart Preview (name, Price) in page.aspx. When I click on the button on the DataList in Con1 it adds the item into the Session based Cart. However it does not update the Cart Preview. I need to call BindPreview() in Con2 in order to update the Cart Preview... Does that make sense? argh! any help much appreciated! PeteWeb Design Nottingham, UK Well I can call BindPreview() from m...

access controls on web user control x from web user control Y
I have 2 web users controls in a page and I would like to get or set the selected values of a few dropdown boxes on web user control X from web user control Y and I also would like to know how to access functions that are on a web user control X from a web user control Y, is this possible? How can I do it? User can access and set the values of the User Control from .aspx page through properties,using javascript and in code-behind of aspx page.The details of it are shown below Using PropertiesIf the Sample.ascx control has two textboxes and submit button.You can access the valu...

Problem in accessing web form data in user controls when create user control dynamically
HI. I have a problem using web user control. I designed a user control named NewsForm. This user control contains some web form elements like <asp:textbox>. When I add it in an .ASPX page, all things may be true. I can know which user filles in textbox (for example and other controls) <%@ Register TagPrefix="uc1" TagName="NewsForm" Src="NewsForm.ascx" %> and <UC1:NewsForm id="newsForm" runat="server"></UC1:NewsForm> But when i create it in code behined dynamically, however user control has web form controls but their value are blank for example //aspx co...

UpdatePanel within a web user control resets data of controls outside the user control
Hello, I have a usercontrol on my page which displays a running marquee text. It makes use of an UpdatePanel (within the user control) to refresh the marquee text (within the updatepanel) at periodic intervals. For this I added a timer control and its tick event as an async postback trigger for the UpdatePanel. I have a lot of textboxes and dropdown list boxes (all with runat=server) on the page outside the above user control. These are also contained in different UpdatePanels. Problem is, when the user control does a postback to refresh the marquee text, it causes some of...

Persisting data in a web user control, which contains a list of other web user controls.
 Hi All, I have a control I've created, which can have a number of child controls - also user controls - stored as an ArrayList, which can be added wither a design time or programmatically.My problem is when I add to the list programmatically, it doesn't persist them. So if I add 3 child controls in step 1 of a wizard, with the aim that those three will be visible inside the parent in step 3, what happens is that the parent has no child controls and the item count is 0.Can anyone help? Thanks in advance.Code:Parent Control Markup: <%@ Control Language="C#" Auto...

User control in a user control
Hello all, I have created a user control with some checkboxes, and public properties to get the values of these checkboxes. I have also created a second user control using the first user control; this second control also access the public properties of the first one. My problem is when I implement the second control in an aspx page, if I click at runtime the checkboxes in the first control, I am able to access its public properties from the methods of the second control but the values of these properties are wrong. while at design time, I do not have this problem. Than...

User Control in a User Control
I have a first user control that contain a second user control. If I cahe the first user control can I still dynamically control the second one or it is cached with the first one therefore can not control it anymore? Thanks When your first control is cached, its rendered out and its output is stored in the cache. On every request to the page containing your control that can satisfy it from cache, the output will just simply be inserted - your first control will never be instantiated or run in that case, so the second one wont be either. Hope this helps,Mike VolodarskyProgram Manager...

User Controls in User Controls?
I have the follow set up and it is throwing an error "Unhandled error loading module" ... is there some trick to this that I don't know?I have a project A that uses controls from project B (project B is just a project with all my user controls used through out other modules).  project A uses user control 1 from project B with out any issues at all - great.  But then I wanted to add user control 2 to user control 1 and that is when I get my error.  In fact I don't even have the user control 2 in user control 1, just when I put the register part into user control 1 is when it al...

user control to user control
I have an aspx page that have a "Register" directive to two usercontrol called rptMaster.ascx and rptDetail.ascx. I'm trying to set up a Master-Detail relationship and wish for the rptMaster.ascx to trigger and event from a dropdownlist and for the rptDetail to be listening for DropDownList event. I believe I have gotten the events part okay with help from this articel http://codeproject.com/aspnet/Page_UserControl.asp but my declaration for a private statement to my rptMaster class is producing an error. I'm using beta 2 of asp.net and I 'm having trouble getting a reference TO ...

User Control Within UserControl
If I have a user control A and then inside it a user control B embedded/referenced within it.  User Control A has a panel defined (cpeNewUser) that I want to manipulate from the code behind of User Control B based on some event that happens.So putting this in my code behind of User Control B won't work as it has no idea of cpeNewUser:cpeNewUser.Collapsed = true;So is it because only at runtime they are married up and because of this you cannot access each other's objects at compile time?  How would I get this to work becuase I'm using all user controls inside a AJAX Too...

How to access individual controls from a form containing the web user control containing those controls
 Below is a block of code in my .aspx form named default.aspx. In this form I load a web user control. I then add it to a place holder control.(Lines 3 and 4 below) So how do I access the individual controls in my web user control? I want to set the properties on those controls, but I am baffled as to how to access the control. For example I have a text label control named "label3". How do I access this control. Because for example, under certain situations I want to hide that control. ( Label3.Visible = false;)  1    if(!Page.IsPostBack) 2&nb...

Web user control inside update panel replace with another web user control
 Hi there. I have a page with a menu. an and then the content. My thing is. That i have the update panel, and inside that i have a regual panel in which i add the Web User Controls i need. Which all works fine. My problem is. That i i have a submit funcion on almoast all the Web User controls. What i would like is that i inside that update panel, can dispose the original Web user Control and then add a response Web User Control. In normal language. Is there a way that i can load one web user control into antoher and then disposose the original? Thanks in advance hello. well, what ...

User control inheriting from another user control possible?
I have a base user control defined in one library. I am referencing this library in another web project with another user control subclassing the base user control. Everything compiles fine, however, when I run the code with no changes to the child user control(expecting to see output for the base user control), I see nothing from the base user control. What do I need to override to force the parent rendering? Thanks! Friend, we can inherit one user control from another and here are the tutorials for you to help and get the insight http://www.dotnetcurry.com/ShowArticle.aspx?ID=155 h...

Add user control from user control to web page
Hi there, I have a user control, that is inside another user control on a web page. From this user contfol, I need to add something to a place holder on the parent web page. I am having troubles referencing the placeholder correclty. I can get it fine as build time, but on runtime it kicks up the "Object reference not set to an instance of an object" error. Any ideas would be greatly appreciated. -------------------------------------------------------------- protected Civil_and_Corporate.candcadmin._default _default; ------------------------- Control objControl...

Web resources about - Inherits user controls from my own user control. - asp.net.web-forms

Inherit the Wind (play) - Wikipedia, the free encyclopedia
Henry Drummond, Matthew Harrison Brady, E. K. Hornbeck, Bertram Cates, Rachel Brown, Rev. Jeremiah Brown Inherit the Wind is a play by Jerome ...

Inherit The Wind - Spencer Tracy Speech - YouTube
A favorite scene from one of my favorite films, INHERIT THE WIND.

FBI chief James Comey inherits extremists and budget cuts
Washington: The Arab Spring uprisings have created a new breed of violent extremists that will threaten the US and its citizens abroad for years ...

Leighton inherits bulk of NBN contracts
Construction giant Leightons has emerged with a large slice of NBN Co contracts, following ownership changes at contracting firm Silcar.

Inherit the wind: dinosaurs blamed for changing climate
Inherit the wind: dinosaurs blamed for changing climate

Sting: my children won't inherit my wealth
Musician estimated to be worth £180m says he does not want to leave his six children "trust funds that are albatrosses round their necks".

New government will inherit a money pit
I AM pretty sure I have bad taste in movies because I rather enjoyed The Money Pit, starring Tom Hanks and Shelley Long.

Prince William and Prince Harry to inherit Princess Diana's wedding dress
Prince William and Prince Harry are set to inherit their mother Princess Diana's wedding dress, just in time for Harry's 30th birthday.

Reality check: Do babies inherit junk food addictions from their moms?
Expectant mommies using pregnancy as a ticket to eat for two may be reluctant to do so now after a new study suggests that giving into junk food ...

Prince William 30th Birthday Inheritance: Prince Set To Inherit $15 Million
It's hard to believe that Prince William turns 30 on Thursday (June 21st).

Resources last updated: 11/30/2015 4:23:22 AM