Server Controls

  • Thread starter Rex the Strange
  • Start date
R

Rex the Strange

Help, please.

Using the Web Site model I can include a custom server control by
putting it into my app_code directory and referencing it in my web
page, thusly:

<%@ register tagprefix='myprefix' namespace='local.namespace' %>

and could then use the control without compiling it into an assembly,
like so:

<myprefix:mytag runat='server' [blah blah blah] />

(where mytag is a control defined in the local.namespace namespace).

This doesn't seem to work in using the Web Application model. How can
I do this in a Web Application (without having to compile it into an
assembly - if possible)?

Tia,

rts.
 
P

Peter Bromberg [C# MVP]

Try moving the class file out of the APP_CODE Folder and into the project.
But really, the whole purpose of a CustomControl is to be reusable across
solutions. So, you are better off making a separate control project and
compiling it, then set a reference to either the built control asssembly in
your /bin folder, or to the control project in your solution as a project
reference.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
 
R

Rex the Strange

Try moving the class file out of the APP_CODE Folder and into the project.
But really, the whole purpose of a CustomControl is to be reusable across
solutions. So, you are better off making a separate control project and
compiling it, then set a reference to either the built control asssembly in
your /bin folder, or to the control project in your solution as a project
reference.
-- Peter
Site:http://www.eggheadcafe.com
UnBlog:http://petesbloggerama.blogspot.com
Short Urls & more:http://ittyurl.net



Rex the Strange said:
Help, please.
Using the Web Site model I can include a custom server control by
putting it into my app_code directory and referencing it in my web
page, thusly:
<%@ register tagprefix='myprefix' namespace='local.namespace' %>
and could then use the control without compiling it into an assembly,
like so:
<myprefix:mytag runat='server' [blah blah blah] />
(where mytag is a control defined in the local.namespace namespace).
This doesn't seem to work in using the Web Application model. How can
I do this in a Web Application (without having to compile it into an
assembly - if possible)?

rts.- Hide quoted text -

- Show quoted text -

I tried moving it out of the app_code folder (which is really
meaningless in a web app) but to no avail. I have my reasons for not
wanting to compile it into an assembly or have a single control
project, that being, that the control changes from application to
application and I need to keep each version for each app. But thanks
anyway.

Any other suggestions?
 
R

Rex the Strange

Try moving the class file out of the APP_CODE Folder and into the project.
But really, the whole purpose of a CustomControl is to be reusable across
solutions. So, you are better off making a separate control project and
compiling it, then set a reference to either the built control asssembly in
your /bin folder, or to the control project in your solution as a project
reference.
-- Peter
Site:http://www.eggheadcafe.com
UnBlog:http://petesbloggerama.blogspot.com
Short Urls & more:http://ittyurl.net
Rex the Strange said:
Help, please.
Using the Web Site model I can include a custom server control by
putting it into my app_code directory and referencing it in my web
page, thusly:
<%@ register tagprefix='myprefix' namespace='local.namespace' %>
and could then use the control without compiling it into an assembly,
like so:
<myprefix:mytag runat='server' [blah blah blah] />
(where mytag is a control defined in the local.namespace namespace).
This doesn't seem to work in using the Web Application model. How can
I do this in a Web Application (without having to compile it into an
assembly - if possible)?
Tia,
rts.- Hide quoted text -
- Show quoted text -

I tried moving it out of the app_code folder (which is really
meaningless in a web app) but to no avail. I have my reasons for not
wanting to compile it into an assembly or have a single control
project, that being, that the control changes from application to
application and I need to keep each version for each app. But thanks
anyway.

Any other suggestions?- Hide quoted text -

- Show quoted text -

Anyone?
 

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

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,237
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top