473,770 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmatic CheckBox Event Not Firing

Hi,

I have a checkbox control programmaticall y created for each row in the datagrid but CheckedChanged event not firing when state of the checkbox changes.

I use the following code to instantiate ItemTemplate with checkbox contructor:

public class TemplateObject : ITemplate {
public void InstantiateIn(C ontrol objContainer) {
CheckBox objCheckBox = new CheckBox();
objCheckBox.ID = "Item";
objCheckBox.Che ckedChanged +=new EventHandler(ob jCheckBox_Check edChanged);
objContainer.Co ntrols.Add(objC heckBox);
}

public void objCheckBox_Che ckedChanged(obj ect sender, EventArgs e) {
CheckBox objCheckBox = (CheckBox)sende r;
if(objCheckBox. Checked) {
//Do Something
}
}
}

Any advice much appreciated.
Andrew

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
Nov 18 '05 #1
3 2026
You don't have set autopostback=tr ue;

"DotNetJunk ies User" <User@-NOSPAM-DotNetJunkies.c om> ha scritto nel
messaggio news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi,

I have a checkbox control programmaticall y created for each row in the
datagrid but CheckedChanged event not firing when state of the checkbox
changes.

I use the following code to instantiate ItemTemplate with checkbox
contructor:

public class TemplateObject : ITemplate {
public void InstantiateIn(C ontrol objContainer) {
CheckBox objCheckBox = new CheckBox();
objCheckBox.ID = "Item";
objCheckBox.Che ckedChanged +=new
EventHandler(ob jCheckBox_Check edChanged);
objContainer.Co ntrols.Add(objC heckBox);
}

public void objCheckBox_Che ckedChanged(obj ect sender, EventArgs e) {
CheckBox objCheckBox = (CheckBox)sende r;
if(objCheckBox. Checked) {
//Do Something
}
}
}

Any advice much appreciated.
Andrew

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup
engine supports Post Alerts, Ratings, and Searching.

Nov 18 '05 #2
Not sure, but did you trying setting Autopostback to true?

"DotNetJunk ies User" <User@-NOSPAM-DotNetJunkies.c om> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi,

I have a checkbox control programmaticall y created for each row in the
datagrid but CheckedChanged event not firing when state of the checkbox
changes.

I use the following code to instantiate ItemTemplate with checkbox
contructor:

public class TemplateObject : ITemplate {
public void InstantiateIn(C ontrol objContainer) {
CheckBox objCheckBox = new CheckBox();
objCheckBox.ID = "Item";
objCheckBox.Che ckedChanged +=new
EventHandler(ob jCheckBox_Check edChanged);
objContainer.Co ntrols.Add(objC heckBox);
}

public void objCheckBox_Che ckedChanged(obj ect sender, EventArgs e) {
CheckBox objCheckBox = (CheckBox)sende r;
if(objCheckBox. Checked) {
//Do Something
}
}
}

Any advice much appreciated.
Andrew

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup
engine supports Post Alerts, Ratings, and Searching.


Nov 18 '05 #3
Thank you chaps, been puzzled by such a simple property that I hav completely
forgotten.

Andrew

"DotNetJunk ies User" wrote:
Hi,

I have a checkbox control programmaticall y created for each row in the datagrid but CheckedChanged event not firing when state of the checkbox changes.

I use the following code to instantiate ItemTemplate with checkbox contructor:

public class TemplateObject : ITemplate {
public void InstantiateIn(C ontrol objContainer) {
CheckBox objCheckBox = new CheckBox();
objCheckBox.ID = "Item";
objCheckBox.Che ckedChanged +=new EventHandler(ob jCheckBox_Check edChanged);
objContainer.Co ntrols.Add(objC heckBox);
}

public void objCheckBox_Che ckedChanged(obj ect sender, EventArgs e) {
CheckBox objCheckBox = (CheckBox)sende r;
if(objCheckBox. Checked) {
//Do Something
}
}
}

Any advice much appreciated.
Andrew

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6443
by: AFN | last post by:
I want to click a checkbox and have a 4 line (approx) paragraph appear beneath the checkbox, pushing the rest of the page down. And when unchecking the checkbox, the paragraph should disappear and the part below should push back up again. How?
2
3870
by: alien2_51 | last post by:
Can some one tell me why the onclick is firing twice for the radion button and checkbox controls...? <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Testing.aspx.vb" Inherits="CustomerRelations.Testing" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>Testing</title> <!--
5
3130
by: Greg Hurlman | last post by:
I've got a very simple ASCX page, where once someone finishes a section and clicks the "Next >" button, the section they just finished is disabled, and the next section appears below it, and so on. One of the controls is a checkbox, which, when clicked, displays a hidden panel containing controls whose input are used for filtering query results. If someone checks the checkbox in the first section and clicks the first "Next >" button,...
3
4852
by: Jack Turnbull | last post by:
Hi, I have a Checkbox in a Repeater set to AutoPostBack = true. I have pointed OnCheckedChanged to a Sub but it doesn't fire. If I move the checkbox out of the Repeater it fires! Any ideas? Thanks
5
3370
by: tshad | last post by:
Is there a way to allow a user to press a radio button if it is already selected? There is an onCheckedChanged event that fires when the person presses the button and it is isn't selected already. If it is selected, it doesn't fire. This isn't the case with a checkbox. The event fires whether the control is already checked or not. Thanks,
1
1228
by: rodchar | last post by:
hey all, is the following even possible? i have a datagrid with checkboxes on each row, when a user clicks on the checkbox i'd like to populate one of the fields in the grid with the current date. how would i do that?
2
10781
by: dilip.movva | last post by:
Hi, In the ItemDataBound of my datagrid I am creating a checkbox dynamically. I have the eventhandler defined for CheckedChanged of the check box. The event is not firing. The grid is bound in the Page_Prerender method. My code is something like this Private Sub grdMissingData_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdMissingData.ItemDataBound If e.Item.ItemType =...
2
1833
by: Deano | last post by:
I have a subform that is populated by a table that holds lots of yes/no values. The user sees points at the side and then periods across the top. So they decide they want point 20 for period 5 and go click that checkbox. This in turn fires of various calculation code in the After_Update event of the checkbox. This all works rather well. I now need to check a given checkbox using code. I'm attempting to create a recordset based on...
4
4276
by: sarabonn | last post by:
Hello everyone, Iam firing a event in the chechbox_checkedchanged. It works fine private void checkBox1_CheckedChanged(object sender, EventArgs e) { / textBox1.Visible = false; textBox2.Visible = false; button2.Visible = false;
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10259
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.