473,405 Members | 2,373 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,405 software developers and data experts.

CheckBox AutoPostBack=True

I have a DataGrid where in the first column of each row is a CheckBox
(the CheckBoxes reside in the TemplateColumn of the DataGrid). The
CheckBox's AutoPostBack property is set to True & its CheckedChanged
event invokes a sub named 'CheckChanged'. The ID of the CheckBox in the
DataGrid is 'chk'. This is the sub 'CheckChanged':

Sub CheckChanged(ByVal obj As Object, ByVal ea As EventArgs)
Dim cbox As CheckBox
Dim dgiRow As DataGridItem

For Each dgiRow In dg1.Items
If (dgiRow.ItemType = ListItemType.Item Or dgiRow.ItemType =
ListItemType.AlternatingItem) Then
cbox = dgiRow.FindControl("chk")
If (cbox.Checked) Then
'doing something here
Else
Response.Write("hello<br>")
End If
End If
Next
End Sub

Assuming that the DataGrid has 10 rows, when I check one of the
CheckBoxes, then the text 'hello' appears 9 times...that's OK.... Next
I uncheck this checked CheckBox; the page gets posted but what I find
is the text 'hello' does not appear at all. Even if I add a
Response.Write("ABCD") line at the very top of the 'CheckChanged' sub
(i.e. it becomes the first line in the sub), then also when the only
checked CheckBox is unchecked & the page posts, the page doesn't
display the text 'ABCD" as well.

Why doesn't the sub 'CheckChanged' fire when the only checked CheckBox
is unchecked (which means that none of the CheckBoxes are checked in
the DataGrid)?

Dec 3 '06 #1
0 1374

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

Similar topics

3
by: KathyB | last post by:
Hi, clearly I'm just not getting something here. I have an aspx form with ONE textbox and several label controls on it. I have the textbox set to AutoPostBack = True, but when I enter my text...
8
by: Matthew Louden | last post by:
why need to set autopostback property to be true?? I know autopostback event means to send the form to the server automatically. I tried checkbox, checkbox list, radio button, and radio button...
1
by: Edward | last post by:
I am having a terrible time getting anything useful out of a listbox on my web form. I am populating it with the results from Postcode lookup software, and it is showing the results fine. What...
1
by: Mad Scientist Jr | last post by:
I'm having this issue where textbox A on my form is recalculated every time textbox B, C, or D is changed. To complicate this, if dropdown D = 1, for example, A = B + C, if dropdown D = 2, A = C *...
1
by: John Oakes | last post by:
I have a TextBox with AutoPostBack = True. Often a user needs to click directly from this control to a RadioButtonList. Because the TextBox immediately posts back, the RadioButtonList selection...
3
by: Wei | last post by:
Hi, I have a page written in ASP.net c# witch has a datalist with 200 records (in Itemtemplate). Each record includes nine webcontrol radio buttons as a group. The user will need to check...
1
by: Scotty | last post by:
Hi How to databanding checkbox in windowsform code below does not work Me.txtFax.DataBindings.Add("text", bsAdressen, "Fax") 'Works fine Me.txtEmail.DataBindings.Add("text", bsAdressen,...
1
Fary4u
by: Fary4u | last post by:
Hi is any body know where is actual problem is coz it's look me some problem ? to insert value into the MS ACCESS DATABASE after the value is true form html <input type="checkbox"...
1
by: indirareddy | last post by:
Hai this Indira Reddy ................ If suupose not applied to dropdownlist autopostback true it is working or not run time (server side)
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.