shreyas R S

shreyas R S

  • 2.2k
  • 1
  • 2.4k

javascript to check if checkbox is checked asp.netuser cntrl

Mar 14 2013 3:03 PM
Hi All,

I have a html checkbox control and Button in my User control.

Now i need to check whether checkbox is checked when button is clicked.

I am using the below code. But it does not work :(

In webusercontrol1.ascx,

<script type="text/javascript">
$(document).ready(function () {
$("input[id*=remember]").change(function () {
if (this.checked)
alert("its checked");

<input id="remember" name="remember" type="checkbox" />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

In webusercontrol1.ascx.cs,

protected void Button1_Click(object sender, EventArgs e)


ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "function();", true);

// my rest of the code once checkbox is clicked


Answers (1)