Server Controls

  • Thread starter Thread starter Rex the Strange
  • Start date 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.
 
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
 
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?
 
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 asssemblyin
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?
 
Back
Top