|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
asp.net 2.0: Webcontrols in LibraryHello
I just want to re-use some of my webcontrols (*.ascx) as library. When I add those to the library, they are automaticly splitted up into two files (as it is also in the web-project), but there is no relation between those files. What now happens, in ASP.NET 2.0, when I just add a label, e.g. <asp:label id=test runat=server/> in the ascx.cs file, I directly can access the label without defining it (as it was necessary in the 1.1). When I take that over to the library, it just says, "The name "test" does not exist in the current context" ... is there a way to tell the compiler to check the ascx file in some way?? Thnx Patrick User controls are not designed to be used in a control library.
For that level of reusability you should instead create custom controls. Here are more details: http://SteveOrr.net/faq/UserCustom.aspx Show quoteHide quote "news.microsoft.com" <Patrick> wrote in message news:%23YtTpeshFHA.1416@TK2MSFTNGP09.phx.gbl... > Hello > > I just want to re-use some of my webcontrols (*.ascx) as library. When I > add those to the library, they are automaticly splitted up into two files > (as it is also in the web-project), but there is no relation between those > files. > > What now happens, in ASP.NET 2.0, when I just add a label, e.g. <asp:label > id=test runat=server/> in the ascx.cs file, I directly can access the > label without defining it (as it was necessary in the 1.1). When I take > that over to the library, it just says, > > "The name "test" does not exist in the current context" ... is there a way > to tell the compiler to check the ascx file in some way?? > > Thnx Patrick > Steve, thanks for your reply. So in that case I see, I have to rewrite my
controls, what wouldn't be a funny job, but seems to be the one and only solution Thanks Show quoteHide quote "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> schrieb im Newsbeitrag news:uVMlJDwhFHA.1164@TK2MSFTNGP10.phx.gbl... > User controls are not designed to be used in a control library. > For that level of reusability you should instead create custom controls. > Here are more details: > http://SteveOrr.net/faq/UserCustom.aspx > > -- > I hope this helps, > Steve C. Orr, MCSD, MVP > http://SteveOrr.net > > > "news.microsoft.com" <Patrick> wrote in message > news:%23YtTpeshFHA.1416@TK2MSFTNGP09.phx.gbl... >> Hello >> >> I just want to re-use some of my webcontrols (*.ascx) as library. When I >> add those to the library, they are automaticly splitted up into two files >> (as it is also in the web-project), but there is no relation between >> those files. >> >> What now happens, in ASP.NET 2.0, when I just add a label, e.g. >> <asp:label id=test runat=server/> in the ascx.cs file, I directly can >> access the label without defining it (as it was necessary in the 1.1). >> When I take that over to the library, it just says, >> >> "The name "test" does not exist in the current context" ... is there a >> way to tell the compiler to check the ascx file in some way?? >> >> Thnx Patrick >> > >
Please Help: ListBox.SelectedItem returns null
Can aspnet simulate windows pane separator? Error: Multiple controls with the same ID ListItem individual Color Web User Controls: Exposing Items property of contained controls Load User Control from different directory Collection with the correct object type on the Collection dialog DropDownList <optgroup> Setting control value in Javascript validator for drop down list box |
|||||||||||||||||||||||