Link to home
Start Free TrialLog in
Avatar of Beircheart
Beircheart

asked on

Asp.Net - Get Height of HtmlGenericControl

Hi,

Using ASP.Net, how do you get the height of a HtmlGenericControl?

Non-Functional Example:

Dim ContentPaneControl As HtmlGenericControl = CType(Master.FindControl("ContentPane"), HtmlGenericControl)

Dim MyDivHeight As String = ContentPaneControl.Attributes("height").ToString

Thank you,
Ben
Avatar of BurnieP
BurnieP
Flag of Canada image

If you change Attributes for Style?

Dim MyDivHeight As String = ContentPaneControl.Style("height").ToString
Avatar of Beircheart
Beircheart

ASKER

No go I'm afraid

"Object reference not set to an instance of an object"

I think you have a problem with getting your control.

Get the ContentPlaceHolder first

Dim mContentPlaceHolder As ContentPlaceHolder = CType(Master.FindControl("ContentPlaceHolder1"), ContentPlaceHolder)
(where "ContentPlaceHolder1" is the ID of your ContentPlaceHolder.

Then try :

Dim ContentPaneControl As HtmlGenericControl = CType(mContentPlaceHolder .FindControl("ContentPane"), HtmlGenericControl)

ASKER CERTIFIED SOLUTION
Avatar of Beircheart
Beircheart

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This workaround will have to do