which values are sent with a postback?

  • Thread starter Thread starter Bart
  • Start date Start date
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
 
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.
 
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)
 
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.
 
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.
 
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
 
Back
Top