title: Javascript __dopostback(): arguments passing error "Invalid postback or callback argument"
body: <p>I would like to raise an event in javascript from Asp.net code behind page; whenever a checkbox control is checked. I am able to use <code>__dopostback</code> from javascript to raise an event in the code behind, but I'm not able to pass a variable as argument. </p>
  
  <p>This is the javascript code:</p>
  
  <pre><code>function CallServerCkhkBox(chkvalue) {
      alert("_dopostback " + chkvalue);
      __doPostBack('btnRefresh', chkvalue);
      //__doPostBack('btnRefresh', 'Blue Green');
  }
  </code></pre>
  
  <p>The alert prints the correct value of the variable chkvalue.</p>
  
  <p>This is the C# code behind:</p>
  
  <pre><code>protected void btnRefresh_Click(object sender, EventArgs e)
  {
      string checkboxes;
      if (Request["__EVENTARGUMENT"] != "")
      {
          checkboxes = "From Javascript " + Request["__EVENTARGUMENT"];
      }
      else
      {
          checkboxes = "From Click " + hdnChkbval.Value;
      }           
      lblCheckBoxes.Text = checkboxes;
  }
  protected override void Render(System.Web.UI.HtmlTextWriter writer)
  {
      ClientScript.RegisterForEventValidation("btnRefresh", "Blue Green");
      base.Render(writer);
  }
  </code></pre>
  
  <p>If I pass an argument a fixed string to <code>__dopostback</code> it works, otherwise it returns the error:</p>
  
  <blockquote>
    <p>Invalid postback or callback argument.</p>
  </blockquote>
  
  <p>I believe in the RegisterForEventValidation() method, the exact value is not declared.</p>
  
  <p>Is there any way to pass a variable string?</p>