Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

One more ASP.Net control question

This one will be real easy - or so it seems:

When I add an HTML control to my web form (with
runat=server), it doesn't [always] automatically add the
corresponding control object to the codebehind class. With
ASP Web controls, it does.

Is that by design, or am I missing something ?

Thanks.

Mike
Friday, December 13, 2002

I just found something strange: if you add an HTML control
and then hit F7 to go to the code-behind file, the control
object isn't there; but if you double-click on the control
on your form to go to the code, guess what - all the HTML
controls are now magically listed in the class.

Whether this is a bug or a feature, it's  yet another reason not to use HTML controls....

Mike
Friday, December 13, 2002

Yet another reason? What the heck? Maybe "yet anothe reason" not to use VS.NET's wysiwyg web forms designer, but the controls in general are a godsend, both the webcontrols and the htmlcontrols... inerhit and improve where necessary.

Jake
Sunday, December 15, 2002

I'm pretty sure that HTML controls show up in codebehind as soon as you switch them to runat="server" in VS.NET, at least with the VB.NET web forms designer.

Dave Rothgery
Monday, December 16, 2002

Hehe Ive been doing ASP.net for about a year now and I've noticed that it really depends on if your in design view or HTML view when your adding and removing your controls.  I find the designer does some funky stuff, especially with shifting around the way you lay out your html..

Andrew McTeer
Monday, December 16, 2002

>I'm pretty sure that HTML controls show up in codebehind >as soon as you switch them to runat="server" in VS.NET,
>at least with the VB.NET web forms designer.

ASP controls do, but not HTML controls, at least not if you
go to the code window by hitting F7. Or so it seems to
be for me.

Mike
Monday, December 16, 2002

I've always converted an HTML control to a server-side control in VS.NET by right clicking on it in design view and selecting 'run as server control'; maybe that handles creating the control in codebehind automagically.

Dave Rothgery
Tuesday, December 17, 2002

*  Recent Topics

*  Fog Creek Home