Usercontrol derived from Usercontrol without double Html Code

R

Reik

Hi everyone,
lets say I have written a usercontrol called url.ascx. The Html portion of
this usercontrols contains a single textfield to enter a URL. The entered URL
is handled in the code behind, checked for syntax bla bla..
Now Iam writing a second usercontrol called link.ascx that derives from url.
In link.ascx I have another textfield where the user can enter the text of a
link. Still I want to display the textfield for the URL. So basically I want
the Html from the url.ascx to be displayed above the link.ascx. Also if the
Page is posted, I want the codebehind in url.ascx to validate the user input
in the url textbox and the codebehind for link.ascx to handle the user input
in the linktext textbox. Is that possible? I dont wanna double all the Html
code when deriving a usercontrol.
 
B

Brock Allen

You should use containment not inheritance. Have link.ascx create an instance
of url.ascx via the LoadControl API.
 

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

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top