Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 219355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:50:13+00:00 2026-05-11T18:50:13+00:00

I have a simple task – to change page link on checkbox state change

  • 0

I have a simple task – to change page link on checkbox state change – but I’m new to ASP.NET and have some trouble.

I can do the same using HtmlControl and JavaScript:

<script type="text/javascript" language="javascript">
  function checkbox_onChanged(checked) {
    if (checked) {
      document.location = '?type=request_in&show=all';
    }
    else {
      document.location = '?type=request_in&show=unapproved';
    }
  }

  function checkbox_onLoad(checkbox) {
    checkbox.checked = true;
  }
</script>

<form action="" method="get">
<input type="checkbox" name="checkbox"
  onload="checkbox_onLoad(this)"
  onchange="checkbox_onChanged(this.checked)" />Show all
</form>

but I want to hide it from users. So I do:

<asp:CheckBox runat="server" ID="check" 
  OnCheckedChanged="check_CheckedChanged"
  AutoPostBack="True" Text="Show all" />

protected void check_CheckedChanged(object sender, EventArgs e)
{
  Response.Redirect(String.Format("{0}?type=request_in&show={1}", Request.Path, 
  checkViewRequestIn.Checked ? "all" : "unapproved"));
}

protected void Page_Load(object sender, EventArgs e)
{
  var show = Request["show"];
  if (!String.IsNullOrEmpty(show) && String.Equals(show, "all"))
  {
    checkViewRequestIn.Checked = true;
  }
}

But it seems that check state change on load raises the event again and checkbox becomes checked always!

Ans another question – is there any other way to redirect to the same page without giving it’s filename? I mean like in JavaScript – only giving variables needed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:50:13+00:00Added an answer on May 11, 2026 at 6:50 pm

    You can call your client-side ‘checkbox_onChanged’ from the ASP.NET checkbox, just add the ‘onchange’ from the Page_Load, e.g:

    protected void Page_Load(object sender, EventArgs e)
    {
       check.Attributes["onchange"] = "checkbox_onChanged(this.checked)";
    }
    

    View source and you’ll see what is happening in the HTML..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 127k
  • Answers 127k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your class isn't sealed; if the intention is that somebody… May 12, 2026 at 5:29 am
  • Editorial Team
    Editorial Team added an answer First: Since you'll hand out all the code to the… May 12, 2026 at 5:29 am
  • Editorial Team
    Editorial Team added an answer PHP/MySql is brainless simple to set up on a unix… May 12, 2026 at 5:29 am

Related Questions

I have a simple task I need to perform in Python, which is to
I have a simple task - to change page link on checkbox state change
I have a simple task. I have an existing project with a web service
I'm trying to figure out the cleanest way to do this. Currently I have
I've downloaded the svntask for ant from tigris.org, so it is the official one.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.