SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Aug 2004
    Posts
    428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    GetPostBackEventReference - Custom SliderControl

    GetPostBackEventReference(this, "slider.getRealValue();");

    problem is on the client it builds:
    __doPostBack('ctrlid', 'slider.getRealValue()');
    so slider.getRealValue() isn't executed since its a string.

    I've already tired escaping..
    GetPostBackEventReference(this, "'slider.getRealValue();'");
    but that doesn't work


    since there is no actual <input> element. .. 2 divs and a little javascript.
    a postback won't contain the value of the javascript based control.

    i can make it work with a hidden field but would like to know if there is a way using PostBackOptions to get the value from slider.getRealValue() into the argument of the postback reference?

    anyone with any ideas?

  2. #2
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    GetPostBackEventReference is meant to return javascript in a string which you can then use in a handler of your control

    control.Attributes["onclick"] = GetPostBackEventReference(...)

    When onclick fires the javascript emitted by GetPostBackEventReference will be executed. This script in turn will cause a postback to the server which will direct this event to your control.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •