Wednesday, March 28, 2012

Web Control Library

How do I actually add controls to Web Control Library project?
Can I do it visually or it's all in code?No, you can't visually do it. You can do it in code via either the Render()
or CreateChildControls() methods. Nikhil has a great book
http://www.amazon.com/exec/obidos/A...ikhilkothari-20 - though
I'd consider the topic advanced. There are a number of online resources.

Karl

"Mark Goldin" <markgoldin@.comcast.net> wrote in message
news:%23PGLhbfgEHA.3964@.TK2MSFTNGP12.phx.gbl...
> How do I actually add controls to Web Control Library project?
> Can I do it visually or it's all in code?
I see.
Where can I find a sample of how to create a custom control
that would have a label and a text box?

"Karl" <none> wrote in message news:uXqh9tfgEHA.1048@.tk2msftngp13.phx.gbl...
> No, you can't visually do it. You can do it in code via either the
Render()
> or CreateChildControls() methods. Nikhil has a great book
> http://www.amazon.com/exec/obidos/A...ikhilkothari-20 -
though
> I'd consider the topic advanced. There are a number of online resources.
> Karl
>
> "Mark Goldin" <markgoldin@.comcast.net> wrote in message
> news:%23PGLhbfgEHA.3964@.TK2MSFTNGP12.phx.gbl...
> > How do I actually add controls to Web Control Library project?
> > Can I do it visually or it's all in code?
What you are takling about is creating a Composite Web Control. This
article might be useful: http://aspalliance.com/359 (it's part 2 of a 3
part piece, you might be interested in all 3).
There's also this one:
http://msdn.microsoft.com/library/d...ntrolsample.asp

Karl

"Mark Goldin" <markgoldin@.comcast.net> wrote in message
news:OQMeC7fgEHA.2468@.TK2MSFTNGP12.phx.gbl...
> I see.
> Where can I find a sample of how to create a custom control
> that would have a label and a text box?
> "Karl" <none> wrote in message
news:uXqh9tfgEHA.1048@.tk2msftngp13.phx.gbl...
> > No, you can't visually do it. You can do it in code via either the
> Render()
> > or CreateChildControls() methods. Nikhil has a great book
> > http://www.amazon.com/exec/obidos/A...ikhilkothari-20 -
> though
> > I'd consider the topic advanced. There are a number of online
resources.
> > Karl
> > "Mark Goldin" <markgoldin@.comcast.net> wrote in message
> > news:%23PGLhbfgEHA.3964@.TK2MSFTNGP12.phx.gbl...
> > > How do I actually add controls to Web Control Library project?
> > > Can I do it visually or it's all in code?
> >
If you want to design the controls visually what I do is create a second web
project and add all my controls to that. When I need to use the library I
just copy the ascx files into my main web app and add a reference back to my
'controls' web project. I do this to allow our designers access to the
control layout without letting them near the code. It also means that you
have a easy maintainable base line set of the ascx controls that you can
copy into a new project when every you need to use the library.

I would add that this plan seems to have been screwed by asp.net 2.0 as it
would seem that you can no longer add a reference to a web project within a
solution, in fact I cant even find the assembly the project creates at the
moment ;-)

Stephen.

"Mark Goldin" <markgoldin@.comcast.net> wrote in message
news:%23PGLhbfgEHA.3964@.TK2MSFTNGP12.phx.gbl...
> How do I actually add controls to Web Control Library project?
> Can I do it visually or it's all in code?

0 comments:

Post a Comment