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

Discussion in 'ASP .Net' started by Jeremy Chapman, Feb 28, 2006.

  1. 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?
     
    Jeremy Chapman, Feb 28, 2006
    #1
    1. Advertising

  2. Jeremy Chapman

    Raymond Guest

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


    "Jeremy Chapman" <please@Idontlikespam> wrote in message
    news:...
    > 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?
    >
    >
     
    Raymond, Feb 28, 2006
    #2
    1. Advertising

  3. Ok, thanks. that works. What controls are considered form fields?

    "Raymond" <> wrote in message
    news:y70Nf.31422$pE4.18410@trnddc04...
    > The span element isn't a form field.
    > Add the value to a hidden form field besides span.
    >
    >
    > "Jeremy Chapman" <please@Idontlikespam> wrote in message
    > news:...
    >> 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?
    >>
    >>

    >
    >
     
    Jeremy Chapman, Feb 28, 2006
    #3
  4. Jeremy Chapman

    Raymond Guest

    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.

    "Jeremy Chapman" <please@Idontlikespam> wrote in message
    news:OKNq$...
    > Ok, thanks. that works. What controls are considered form fields?
    >
     
    Raymond, Feb 28, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Harvey
    Replies:
    2
    Views:
    390
    Simon Harvey
    Apr 29, 2004
  2. Joby
    Replies:
    0
    Views:
    1,637
  3. Max
    Replies:
    1
    Views:
    484
    Joe Kesselman
    Sep 22, 2006
  4. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    774
    Masudur
    May 25, 2007
  5. Martin
    Replies:
    0
    Views:
    1,222
    Martin
    Apr 28, 2010
Loading...

Share This Page