473,382 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

checkchanged event not firing on uncheck

i have set autopostback to true and viewstate to false.on checking the checkbox, page is getting reload and checkchanged is getting executed as normal. However on unchecking, only page is getting reload and checkchanged is not called.

I am using Microsoft visual studio 2008.
Apr 2 '13 #1

✓ answered by vijay6

Hey jainmohit321, Check your code with the following code.

Expand|Select|Wrap|Line Numbers
  1. using System;
  2.  
  3. namespace WebApplication1
  4. {
  5.     public partial class WebForm1 : System.Web.UI.Page
  6.     {
  7.         protected void Page_Load(object sender, EventArgs e)
  8.         {
  9.             if (!IsPostBack)
  10.             {
  11.                 Label1.Text = String.Empty;
  12.                 CheckBox1.AutoPostBack = true;
  13.             }
  14.         }
  15.  
  16.         protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
  17.         {
  18.             if (CheckBox1.Checked)
  19.             {
  20.                 Label1.Text = "Checked";
  21.             }
  22.             else
  23.             {
  24.                 Label1.Text = "Unchecked";
  25.             }   
  26.         }
  27.     }
  28. }

1 1367
vijay6
158 100+
Hey jainmohit321, Check your code with the following code.

Expand|Select|Wrap|Line Numbers
  1. using System;
  2.  
  3. namespace WebApplication1
  4. {
  5.     public partial class WebForm1 : System.Web.UI.Page
  6.     {
  7.         protected void Page_Load(object sender, EventArgs e)
  8.         {
  9.             if (!IsPostBack)
  10.             {
  11.                 Label1.Text = String.Empty;
  12.                 CheckBox1.AutoPostBack = true;
  13.             }
  14.         }
  15.  
  16.         protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
  17.         {
  18.             if (CheckBox1.Checked)
  19.             {
  20.                 Label1.Text = "Checked";
  21.             }
  22.             else
  23.             {
  24.                 Label1.Text = "Unchecked";
  25.             }   
  26.         }
  27.     }
  28. }
Apr 10 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Steve M | last post by:
Why are my sessions lasting so long? I have them set to 20 minute timeout in config file? The Session_End event is getting called an hour or more sometimes--well after the user has stopped...
5
by: MS Newsgroups | last post by:
Hi, I have a scenario where I am dynamically adding a control from code when a controls event is fired. The problem I have is that when the newly created control is clicked, the click event does...
7
by: Shane Bishop | last post by:
I've been fighting with the Page_Load event firing twice. I looked through this user group and saw several other people having similar problems. There were various reasons for it:...
3
by: Jim Heavey | last post by:
I have two checkboxes on a form. I changed the Autopostback to "true". I code for the check change event. When I click one of the checkboxes, it does perform the Page load event, but does not...
8
by: Paul | last post by:
Hi, In a class i built, i fire an event when a field changes. In a webform that has an instance of the class, the event (from the class) is fired and the code is executed. However, my webpage...
4
by: Larry Morris | last post by:
The following code, pasted into a web form with a link button on it, will cause the page_unload event to fire twice. If I remove the response.redirect, the problem goes away :). I've got a work...
4
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques...
2
by: Dan | last post by:
I have an aspx page with a form on it. There are a couple of textboxes and an ImageButton. The page is loaded from another page using Server.Transfer. When I click on the ImageButton, the...
16
by: tommaso.gastaldi | last post by:
Hello, A probably dumb question... does anyone know hot to avoid that if one keep the mouse pressed on an arrow of the numericUpDown it continues to fire events (it uses evidently a timer) ?...
0
by: Emma Middlebrook | last post by:
Hi there, I'm having problems in an ASP.NET page that is dynamically creating and displaying radio buttons. I have setup a checkchanged event and specified AutoPostBack to true. When the page...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.