Style not applied until refresh...?

M

Monty

Hi, I have a user control in which I set some style properties
programmatically, like so:

divMain.Style.Add("width", Me.PixelWidth.ToString & "px")
Dim iInnerWidth As Integer = Me.PixelWidth - 2
ddlCategory.Style.Add("width", iInnerWidth.ToString)
ddlLocation.Style.Add("width", iInnerWidth.ToString)

I've tried setting these style attributes during the page_load and
page_prerender events of the user control, but for some reason the styles do
not seem to be applied until there has been a postback on the page, and
suddenly everything "pops" to the correct width. What am I missing here?
Thanks in advance...

Monty
 
W

Walter Wang [MSFT]

Hi Monty,

Where are you putting these code? Normally, if you change properties
*after* Render, the changes will not be shown on the page until next
postback.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top