How to get height of div from code behind

Posted by pranaykssoftech-26135 under VB.NET on 5/2/2014 | Points: 10 | Views : 1531 | Status : [Member] | Replies : 3
Hi,

I have declared one div from code behind, and added some text and controls into that. Now I need the height of that div for some reason. My code is --


Dim dv1 As New System.Web.UI.HtmlControls.HtmlGenericControl("DIV")
dv1.InnerHtml = txtAddress.Text


Now the question is how to get height of dv1. I have tried dv1.height but its not working. I also tried dvSeamPropertiesReliance.Style("height") but it also not works for me. Please help me.

Thank you in advance.




Responses

Posted by: Allemahesh on: 5/2/2014 [Member] [MVP] Silver | Points: 25

Up
0
Down
Dear Pranay,

Have you set the height of the div while rendering?
If you set height of the div, then you will get it other wise not.

Happy coding.

pranaykssoftech-26135, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: pranaykssoftech-26135 on: 5/2/2014 [Member] Starter | Points: 25

Up
0
Down
No, I haven't set it at any stage. But I want it after adding some controls. Is there any way to get it.

pranaykssoftech-26135, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 5/2/2014 [Member] [MVP] Silver | Points: 25

Up
0
Down
No. There is no way to get the width of div in your case.

Happy coding.

pranaykssoftech-26135, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response