|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
prevent runat="server"I have a set of webcontrols that will only run on the server. Is there a
way I can specify this in my code, so that the designer using my controls (he is not using visual studio but Adobe Golive on Mac) doesn't have to specify this for each custom control tag ? So instead of <abc:myControl runat="server" /> he can just write <abc:myControl/> thanks in advance I believe there is (if you look at the ASP:ListItem control you will notice
that you don't need to specify runat="server" for that). However, I would not recommend going to the effort of using it unless it is a control that is used ONLY between the opening/closing tags of one of your other controls. This is my recommendation because seeing the runat="server" helps distinguish the server controls from the HTML controls, so it is probably not worth the trouble and possible risk of extra errors unless the control will be used a HUGE number of times on the same page. Show quoteHide quote "Willy Van den Driessche" <willy.van.den.driessche@gmailDOOTcom> wrote in message news:OISdG3qhGHA.3496@TK2MSFTNGP04.phx.gbl... >I have a set of webcontrols that will only run on the server. Is there a >way I can specify this in my code, so that the designer using my controls >(he is not using visual studio but Adobe Golive on Mac) doesn't have to >specify this for each custom control tag ? > > So instead of > <abc:myControl runat="server" /> > > he can just write > <abc:myControl/> > > thanks in advance > Thanks for the answer. I have investigated how the ASP:ListItem
accomplishes this but I have been without luck. As for the visibility, using <myPrefix: should be enough to make it stand out of the ordinary HTML markup (but that of course is gustibus et coloribus). Show quoteHide quote "Nathan Sokalski" <njsokal***@hotmail.com> schreef in bericht news:OSuqCbrhGHA.4284@TK2MSFTNGP05.phx.gbl... >I believe there is (if you look at the ASP:ListItem control you will notice >that you don't need to specify runat="server" for that). However, I would >not recommend going to the effort of using it unless it is a control that >is used ONLY between the opening/closing tags of one of your other >controls. This is my recommendation because seeing the runat="server" helps >distinguish the server controls from the HTML controls, so it is probably >not worth the trouble and possible risk of extra errors unless the control >will be used a HUGE number of times on the same page. > -- > Nathan Sokalski > njsokal***@hotmail.com > http://www.nathansokalski.com/ > > "Willy Van den Driessche" <willy.van.den.driessche@gmailDOOTcom> wrote in > message news:OISdG3qhGHA.3496@TK2MSFTNGP04.phx.gbl... >>I have a set of webcontrols that will only run on the server. Is there a >>way I can specify this in my code, so that the designer using my controls >>(he is not using visual studio but Adobe Golive on Mac) doesn't have to >>specify this for each custom control tag ? >> >> So instead of >> <abc:myControl runat="server" /> >> >> he can just write >> <abc:myControl/> >> >> thanks in advance >> > > Hello,
I don't think there is any way that you can easily get away from including the runat="server" attribute value pair since it is exactly what the server uses to identify sever side nodes. The asp:ListItem can probably get away without it since it is a child of an asp:DropDownList tag that already has a runat="server attribute/value pair. (This would suggest that you could use a <body runat="server ....> tag to trigger server side preprocessing to add the runat tags where necessary but it would probably be challenging.) If you are using XHTML then you probably use xslt preprocessing (with or without the <body runat="server ....> attribute). Again that would lead to challenges because for some tags, i.e. <input>, it is optional to have runat="server" though your practices may allow you to be 100% certain of where you want or don't want runat="server" to appear. If server-side preprocessing is a realistic option then regular expressions may be a path to consider instead of xslt. HTH, mnichols Willy Van den Driessche wrote: Show quoteHide quote > Thanks for the answer. I have investigated how the ASP:ListItem > accomplishes this but I have been without luck. > > As for the visibility, using <myPrefix: should be enough to make it stand > out of the ordinary HTML markup (but that of course is gustibus et > coloribus). > > "Nathan Sokalski" <njsokal***@hotmail.com> schreef in bericht > news:OSuqCbrhGHA.4284@TK2MSFTNGP05.phx.gbl... >> I believe there is (if you look at the ASP:ListItem control you will notice >> that you don't need to specify runat="server" for that). However, I would >> not recommend going to the effort of using it unless it is a control that >> is used ONLY between the opening/closing tags of one of your other >> controls. This is my recommendation because seeing the runat="server" helps >> distinguish the server controls from the HTML controls, so it is probably >> not worth the trouble and possible risk of extra errors unless the control >> will be used a HUGE number of times on the same page. >> -- >> Nathan Sokalski >> njsokal***@hotmail.com >> http://www.nathansokalski.com/ >> >> "Willy Van den Driessche" <willy.van.den.driessche@gmailDOOTcom> wrote in >> message news:OISdG3qhGHA.3496@TK2MSFTNGP04.phx.gbl... >>> I have a set of webcontrols that will only run on the server. Is there a >>> way I can specify this in my code, so that the designer using my controls >>> (he is not using visual studio but Adobe Golive on Mac) doesn't have to >>> specify this for each custom control tag ? >>> >>> So instead of >>> <abc:myControl runat="server" /> >>> >>> he can just write >>> <abc:myControl/> >>> >>> thanks in advance >>> >> > > Thank you both for the responses.
I think the clue is to let the parent object have the runat=server and let the child object derive from System.Object instead of one of Web.UI classes. The father object is then reponsible for the rendering. Thanks, Van den Driessche Willy. Show quoteHide quote "mnichols" <mnicholscwi_nospam@yahoo.ca> schreef in bericht news:O%235SjwyhGHA.3900@TK2MSFTNGP05.phx.gbl... > Hello, > > I don't think there is any way that you can easily get away from including > the runat="server" attribute value pair since it is exactly what the > server uses to identify sever side nodes. > > The asp:ListItem can probably get away without it since it is a child of > an asp:DropDownList tag that already has a runat="server attribute/value > pair. (This would suggest that you could use a <body runat="server ....> > tag to trigger server side preprocessing to add the runat tags where > necessary but it would probably be challenging.) > > If you are using XHTML then you probably use xslt preprocessing (with or > without the <body runat="server ....> attribute). Again that would lead to > challenges because for some tags, i.e. <input>, it is optional to have > runat="server" though your practices may allow you to be 100% certain of > where you want or don't want runat="server" to appear. > > If server-side preprocessing is a realistic option then regular > expressions may be a path to consider instead of xslt. > > HTH, > > mnichols > > Willy Van den Driessche wrote: >> Thanks for the answer. I have investigated how the ASP:ListItem >> accomplishes this but I have been without luck. >> >> As for the visibility, using <myPrefix: should be enough to make it stand >> out of the ordinary HTML markup (but that of course is gustibus et >> coloribus). >> >> "Nathan Sokalski" <njsokal***@hotmail.com> schreef in bericht >> news:OSuqCbrhGHA.4284@TK2MSFTNGP05.phx.gbl... >>> I believe there is (if you look at the ASP:ListItem control you will >>> notice that you don't need to specify runat="server" for that). However, >>> I would not recommend going to the effort of using it unless it is a >>> control that is used ONLY between the opening/closing tags of one of >>> your other controls. This is my recommendation because seeing the >>> runat="server" helps distinguish the server controls from the HTML >>> controls, so it is probably not worth the trouble and possible risk of >>> extra errors unless the control will be used a HUGE number of times on >>> the same page. >>> -- >>> Nathan Sokalski >>> njsokal***@hotmail.com >>> http://www.nathansokalski.com/ >>> >>> "Willy Van den Driessche" <willy.van.den.driessche@gmailDOOTcom> wrote >>> in message news:OISdG3qhGHA.3496@TK2MSFTNGP04.phx.gbl... >>>> I have a set of webcontrols that will only run on the server. Is there >>>> a way I can specify this in my code, so that the designer using my >>>> controls (he is not using visual studio but Adobe Golive on Mac) >>>> doesn't have to specify this for each custom control tag ? >>>> >>>> So instead of >>>> <abc:myControl runat="server" /> >>>> >>>> he can just write >>>> <abc:myControl/> >>>> >>>> thanks in advance >>>> >>> >>
What do validation controls do, internally, on server side to stop to page processing from continuin
add default row to DropDownList Template RadioButton change web.config programmatically Hyperlink control NavigationUrl problem button click event problem menu control will not expand (2.0) how to execute the DeleteCommand in code-behind? drop down list Threading in ASP.NET 2.0 web parts |
|||||||||||||||||||||||