how to parse changes to control attributes by javascript at post back

J

Jeremy Chapman

I've created a custom control which outputs html at runtime like <span
id="controlid" value="myvalue"></span>. On my page I have javascript that
changes the value of the value attribute. On post back I want to parse the
html changed by the javascript and update a server side variable. I thought
this could be done in by the adding IPostBackDataHander interface to my
classes inheritance, and adding the IPostBackDataHandler.LoadPostData to my
class, and in the OnPreRender of my control calling
Page.RegisterRequiresPostBack(this);. My LoadPostData method gets called on
the postback but I still cant seem to get the new value of the value
attribute from the NameValueCollection. What am I doing wrong?
 
R

Raymond

The span element isn't a form field.
Add the value to a hidden form field besides span.
 
R

Raymond

The various input types, textarea, and select.
The html button type, may be, may be not, best not
use that one as a form field.
 

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,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top