473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Control Height

Given
System.Web.UI.Control Control

Can I determine the height of Control without knowing specifically what it
is?
Nov 18 '05 #1
5 1354
Usually controls on the HTML do not have height. (unless was specified in
style).
It's totally up to browser how it renders it. And browser renders controls
based on the size of the window

So i am not sure what you asking for.

George.
"Eric" <ms*********@nospammediserve.com> wrote in message
news:ux**************@TK2MSFTNGP11.phx.gbl...
Given
System.Web.UI.Control Control

Can I determine the height of Control without knowing specifically what it
is?

Nov 18 '05 #2
only client code can know this, unless the style sets an absolute size and
specifies an overflow behavior.

-- bruce (sqlwork.com)
"Eric" <ms*********@nospammediserve.com> wrote in message
news:ux**************@TK2MSFTNGP11.phx.gbl...
Given
System.Web.UI.Control Control

Can I determine the height of Control without knowing specifically what it
is?

Nov 18 '05 #3
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...webuiwebcontro
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...esinservercont
rols.asp?frame=true

#.NET Samples - ASP.NET Style Customization
http://msdn.microsoft.com/library/en...samples-aspnet
stylecustomization.asp?frame=true

#ASP.NET Server Controls and CSS Styles
http://msdn.microsoft.com/library/en...mscontrolscsss
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.)

Nov 18 '05 #4
Steven,
Thanks for the reply. The problem is I don't know if the control I'm
checking will always be derived from WebControl, it might be UserControl and
I was trying to avoid having to check everytime but it looks as if I will
have to.

Thanks
"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:TV*************@cpmsftngxa07.phx.gbl...
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...webuiwebcontro 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...esinservercont rols.asp?frame=true

#.NET Samples - ASP.NET Style Customization
http://msdn.microsoft.com/library/en...samples-aspnet stylecustomization.asp?frame=true

#ASP.NET Server Controls and CSS Styles
http://msdn.microsoft.com/library/en...mscontrolscsss 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.)

Nov 18 '05 #5
Hi Eric,
Thanks for your followup. Yes, when runtime dynamically load a control and
no idea of its type, its better for use to first get its type and then do
certain operations depend on what kind of control it is. And this is very
important when we dealing with page which are composite of many dynamically
loaded control. Anyway, thanks again for posting here.


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.)
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: NancyASAP | last post by:
In case anyone hasn't seen this problem, just sharing the info.... I created a dotnet 1.1 page with a literal control. I used a streamreader to open a text file to fill the control. I filled the...
6
by: Bruce Rusk | last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what may be a slight bug in it. I have a lot of non-Western language (Chinese) text in my RTF field, and such records get...
0
by: Chris Millar | last post by:
I have a user control that i wish to extend to change the date when the user selects the numeric up down button. The code explains itself, hope someone can help. any ideas appreaciated.. ...
11
by: trinitypete | last post by:
Hi all, I have a user control that uses control literal to build a heading with a link, and a div containing links below. As the link heading is hit, I want to change the style of the div,...
1
by: Tebogo Tefo via .NET 247 | last post by:
Hi I have a user control that contains three dropdownlists that I populate according to what was selected in the other dropdownlist (i.e. populate dropdownlist2 after selecting a value in...
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
0
by: Brian Henry | last post by:
Ok I've never implemented a snap location before so I dont really know what im doing wrong here... anyways, I am making a custom slider control that takes dates as its values instead of integers......
9
by: Nathan Sokalski | last post by:
I am using ASP.NET 2.0's ImageMap Control to create 2 imagemaps, one directly below the other. When I do this a thin blank space appears between them. After several days of frustration I realized...
1
by: =?Utf-8?B?am9uZWZlcg==?= | last post by:
I keep getting the message after I converted a regular aspx page to now be based on a master page: "Only Content controls are allowed directly in a content page that contains Content controls."...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.