How ro get the width of the DIV?

G

Guest

Hi,

The DIV is a htmlgenericcontrol object.
I have no idea to get its width.

Is it dctr.Style.Item(?)?
I dont know the ? item.

Your help will be appreciated.
Thank you.

Best regards,
Ocurnos
 
A

AF

Is it dctr.Style.Item(?)?

myDiv.Style.Add("width", "12px");
string myWidth = myDiv.Style["width"];

?

Antonio
 
E

Eliyahu Goldin

You can only get it on client side and then transfer to the server in a
hidden input control.

Eliyahu
 
E

Eliyahu Goldin

Not that simple.

Browsers have their own logic and priorities. They may consider your
instructions as recommendations and set another width.

Eliyahu

AF said:
Is it dctr.Style.Item(?)?

myDiv.Style.Add("width", "12px");
string myWidth = myDiv.Style["width"];

?

Antonio
 
G

Guest

"You can only get it on client side and then transfer to the server in a
hidden input control."
I dont understand what is hidden control. Can u kindly more elaborate on the
above sentence?


Eliyahu Goldin said:
Not that simple.

Browsers have their own logic and priorities. They may consider your
instructions as recommendations and set another width.

Eliyahu

AF said:
Is it dctr.Style.Item(?)?

myDiv.Style.Add("width", "12px");
string myWidth = myDiv.Style["width"];

?

Antonio
 
E

Eliyahu Goldin

<input type=hidden id=inhDivWidth runat=server>

This is an invisible html control. In javascript you get the width of the
panel and assign it to inhDivWidth.value. The value will get to the server
with a postback and your server code can access inhDivWidth.Value.

Eliyahu

Daniel said:
"You can only get it on client side and then transfer to the server in a
hidden input control."
I dont understand what is hidden control. Can u kindly more elaborate on the
above sentence?


Eliyahu Goldin said:
Not that simple.

Browsers have their own logic and priorities. They may consider your
instructions as recommendations and set another width.

Eliyahu

AF said:
Is it dctr.Style.Item(?)?

myDiv.Style.Add("width", "12px");
string myWidth = myDiv.Style["width"];

?

Antonio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top