Hi Eric,
Thanks for posting in the community!
From your description, you're wondering whether it possbile to set the
height attribute of a System.Web.UI.Control's instance without knowing what
the contro acutally is, yes?
If there is anything I misunderstood, please feel free to let me know.
As for this question, here is my suggestion:
1. The System.Web.UI.Control haven't any properties such as Style or event
Height,width to let user specify any of such attributes. In fact, this is a
generic base class of all other web controls. If you'd like to found the
most basic web control base class that has such properties, you may have a
look at the System.Web.UI.WebControls.WebControl class. And here is the
description in MSDN:
------------------------------
The WebControl class provides the properties, methods, and events that are
common to all Web server controls. You can control the appearance and
behavior of a Web server control by setting properties defined in this
class.
#Note Not all controls support every property defined in this class. For
specific information about whether a property is supported, see the
documentation for the specific control.
------------------------------
For more detailed description on the WebControl base class, you may view
the following reference in MSDN:
#WebControl Class
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebuiwebcontro
lswebcontrolclasstopic.asp?frame=true
2. As George has mentioned, all the web server controls will be rendered as
Html elements in the client html page. So in fact, the Style properties
such as Heidht, Width... of the control will be mapped to the proper html
element's attribute. For example, a TextBox Server Control will be rendered
as a <input type=text ..> ,if we specify the "height" and "width" for it,
the two server side properties will be mapped the the below html element
attributes:
<input type=text style="height:30;width:40">
However, some other control will mapped the same property in different way,
such as <table> will mapped the height and width as <table width=..
height=...>
So, it's better to know what the control is when you'd like to specify some
style attributes of the WebServer Control. Do you think so?
And here are some further tech reference on dealing with Styles on ASP.NET
web server control:
#Styles in Server Controls
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconstylesinservercont
rols.asp?frame=true
#.NET Samples - ASP.NET Style Customization
http://msdn.microsoft.com/library/en-us/cpqstart/html/cpsmpnetsamples-aspnet
stylecustomization.asp?frame=true
#ASP.NET Server Controls and CSS Styles
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconwebformscontrolscsss
tyles.asp?frame=true
Hope they're also helpful to you.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)