Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > how can I reference a user control from a page class?

Reply
Thread Tools

how can I reference a user control from a page class?

 
 
Harper Trow
Guest
Posts: n/a
 
      12-14-2007
I am trying to reference a user control from a custom page class that all of
my other pages inherit from. Since the base page class is just a class file
with no aspx partial, I cannot use a @Register directive to register the user
control with the page class. I tried adding the user control to the
web.config so that all pages have access without the @Register directive, but
this did not allow me to reference the user control class name in my page
class, only pages with aspx UI partials. Is there any way to reference a
user control in a custom page class?

Thanks,
 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      01-08-2008
What exactly did you add to the web.config file?
--
Nathan Sokalski
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/

"Harper Trow" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am trying to reference a user control from a custom page class that all
>of
> my other pages inherit from. Since the base page class is just a class
> file
> with no aspx partial, I cannot use a @Register directive to register the
> user
> control with the page class. I tried adding the user control to the
> web.config so that all pages have access without the @Register directive,
> but
> this did not allow me to reference the user control class name in my page
> class, only pages with aspx UI partials. Is there any way to reference a
> user control in a custom page class?
>
> Thanks,



 
Reply With Quote
 
 
 
 
Harper Trow
Guest
Posts: n/a
 
      01-08-2008
<pages>
<controls>
<add tagPrefix="uc" src="~/topmenu.ascx" tagName="topmenu"/>
</controls>
</pages>

"Nathan Sokalski" wrote:

> What exactly did you add to the web.config file?
> --
> Nathan Sokalski
> (E-Mail Removed)
> http://www.nathansokalski.com/
>
> "Harper Trow" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I am trying to reference a user control from a custom page class that all
> >of
> > my other pages inherit from. Since the base page class is just a class
> > file
> > with no aspx partial, I cannot use a @Register directive to register the
> > user
> > control with the page class. I tried adding the user control to the
> > web.config so that all pages have access without the @Register directive,
> > but
> > this did not allow me to reference the user control class name in my page
> > class, only pages with aspx UI partials. Is there any way to reference a
> > user control in a custom page class?
> >
> > Thanks,

>
>
>

 
Reply With Quote
 
Nathan Sokalski
Guest
Posts: n/a
 
      01-08-2008
I can't remember exactly what the reason for the problem was, but when I
first started using UserControls, I had a problem. Somebody eventually told
me to place them in a separate directory, and that fixed my problem. See if
it helps by using the following:

<add tagPrefix="uc" src="~/usercontrols/topmenu.ascx" tagName="topmenu"/>
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Harper Trow" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <pages>
> <controls>
> <add tagPrefix="uc" src="~/topmenu.ascx" tagName="topmenu"/>
> </controls>
> </pages>
>
> "Nathan Sokalski" wrote:
>
>> What exactly did you add to the web.config file?
>> --
>> Nathan Sokalski
>> (E-Mail Removed)
>> http://www.nathansokalski.com/
>>
>> "Harper Trow" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> >I am trying to reference a user control from a custom page class that
>> >all
>> >of
>> > my other pages inherit from. Since the base page class is just a class
>> > file
>> > with no aspx partial, I cannot use a @Register directive to register
>> > the
>> > user
>> > control with the page class. I tried adding the user control to the
>> > web.config so that all pages have access without the @Register
>> > directive,
>> > but
>> > this did not allow me to reference the user control class name in my
>> > page
>> > class, only pages with aspx UI partials. Is there any way to reference
>> > a
>> > user control in a custom page class?
>> >
>> > Thanks,

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
Accessing USER CONTROL which is inside Masterpagethrough Another USER Control inside normal page. Kiran More ASP .Net Web Controls 2 11-14-2006 12:58 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
Web User Control with GridView can derive new Web User Control? ABC ASP .Net 1 10-04-2005 12:29 PM



Advertisments