which values are sent with a postback?

B

Bart

Hi,

A postback sends values back to the server (e.g. the selectedvalue of a
dropdownlist or the text of a textbox).
I changed the text of the textbox and it's forecolor with Javascript.
When doing a postback, i still can see the new text but the new forecolor is
gone.

May i conclude that postback only sends 'values' like selectedvalue or
texboxvalue and not the other properties like forecolor or width ...?
Thanks
Bart
 
G

Guest

Hi,

A postback sends values back to the server (e.g. the selectedvalue of a
dropdownlist or the text of a textbox).
I changed the text of the textbox and it's forecolor with Javascript.
When doing a postback, i still can see the new text but the new forecolor is
gone.

May i conclude that postback only sends 'values' like selectedvalue or
texboxvalue and not the other properties like forecolor or width ...?
Thanks
Bart

Set the Trace attribute of the @ Page directive to true

<%@ Page Trace = "true" %>

You have to set forecolor again after the postback.
 
B

bruce barker

the browser only postback form elements (input, textarea and select).
they are posted back as name value pairs, so only the elements value is
posted back. checkbox and radio only postback their value if checked is
true. submit buttons only postback their value if clicked.


asp.net stores the render value of properties (like forecolor) in
viewstate, and updates the controls to their render value during
onloadviewstate (if viewstate is enabled).

-- bruce (sqlwork.com)
 
G

Guest

asp.net stores the render value of properties (like forecolor) in
viewstate, and updates the controls to their render value during
onloadviewstate (if viewstate is enabled).

Viewstate doesn't help when you set the forecolor using a javascript.
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

Yes you are correct.
So the typical way of storing JavaScript-changed attributes is to put them
into a hidden field so you can process them upon postback.
 
B

Bart

Thanks to all

Steve C. Orr said:
Yes you are correct.
So the typical way of storing JavaScript-changed attributes is to put them
into a hidden field so you can process them upon postback.

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
 

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
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top