Server Controls

Server Controls

am 09.04.2008 19:13:06 von 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:



(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.

RE: Server Controls

am 09.04.2008 20:06:02 von pbromberg

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" wrote:

> 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:
>
>
>
> (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.
>

Re: Server Controls

am 09.04.2008 20:16:21 von Rex the Strange

On Apr 9, 12:06=A0pm, Peter Bromberg [C# MVP]
wrote:
> 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 i=
n
> 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" wrote:
> > 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=3D'myprefix' namespace=3D'local.namespace' %>
>
> > and could then use the control without compiling it into an assembly,
> > like so:
>
> >
>
> > (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?