title: Run javascript method in asp.net webforms method
body: <p>I want to show a javascript alert when a user changes a value in a select-box. This is my code, what am i doing wrong?</p>
  
  <p>aspx</p>
  
  <pre><code>&lt;asp:DropDownList ID="ddlGroups" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddlWagons_SelectedIndexChanged"&gt;&lt;/asp:DropDownList&gt;
  </code></pre>
  
  <p>aspx.cs</p>
  
  <pre><code>    protected void ddlWagons_SelectedIndexChanged(object sender, EventArgs e)
      {
          ClientScriptManager script = Page.ClientScript;
          script.RegisterStartupScript(this.GetType(), "OpenWindowScript", "alert('Clicked')");
      }
  </code></pre>