www.webdeveloper.com
Results 1 to 3 of 3

Thread: Error on __doPostBack, Object doesn't support property or method 'replace'

  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Error on __doPostBack, Object doesn't support property or method 'replace'

    My goal is to trigger CheckedChanged event on server side with javascript

    this is the function:
    <script language="javascript" type="text/javascript">
    function confirmation(checkbox) {
    if (checkbox.checked == true) {
    var answer = confirm('Really confirm ');

    if (answer) {
    __doPostBack(checkbox, '');
    return true;
    }
    else {
    checkbox.checked = false; return false;
    }
    }
    }
    </script>

    when I get to __doPostBack(checkbox, ''); I get error in the title.
    I'm using script manager in asp and when I remove it, all works well, but I need script manager for ajax.

    In debug :

    _uniqueIDToClientID: function PageRequestManager$_uniqueIDToClientID(uniqueID) {
    ->> return uniqueID.replace(/\$/g, '_'); here error is thrown


    Any advice thx.

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    What kind of variable is the passed argument checkbox here?:
    Code:
    function confirmation(checkbox)
    Should be a DOMElement (an object) by all means. Not a string (that means not the value of a name or id attribute)

  3. #3
    Join Date
    Dec 2011
    Posts
    2
    ok,

    I'm using this function which is triggerd on checkbox click. This is just for test to use an object. Same thing happens, same error


    function TestCheckBox() {

    var Inputs = TargetBaseControl.getElementsByTagName("input");

    for (var n = 0; n < Inputs.length; ++n) {
    if (Inputs[n].type == 'checkbox' &&
    Inputs[n].id == 'ContentPlaceHolder1_gridviewJobs_cbChecks_2') {

    __doPostBack(Inputs[n],'');
    return true;
    }


    }
    return false;
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles