473,503 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Events from dynamic checkboxes sometimes handled the wrong way

Dear Newsgroup Readers,

I have a problem with dynamic controls, in a DotNetNuke module, and
event handlers in VB.NET ASP.NET 2.0. Events are firing and being
handled, sometimes good but also sometimes in a wrong way. I always
unchecked the first of the list (See Also Source Code Below):

CheckBox1 sender ID = D0
CheckBox2
CheckBox3
CheckBox4
CheckBox5

CheckBox2 sender ID = D1
CheckBox3
CheckBox4
CheckBox5

CheckBox2 sender ID = D0
CheckBox4
CheckBox5

CheckBox4 sender ID = 1
CheckBox5

CheckBox5 CheckChanged event does not fire first time must uncheck
again

(NB: ID of the sender should always be D0)

And so on. The last remaining one does not fire an event and must be
unchecked again to be removed

I tried everything, code examples on the internet are more or less the
same with mine.
(I tried EnableViewState false and true for page, panel and dynamic
checkboxes)

Any ideas what the problem is? I do not believe that it is one of
those hard to debug asynchrone bugs, because the code is so simple!

PLEASE HELP!

Kind regards,

Johan van der Galien.

Code snipped:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim MyCustomIngredients As New List(Of CustomIngredients)
Dim MyDBItemCheckBox As CheckBox

MyCustomIngredients =
MyDataBase.SelectAllCustomIngredients(UserId)

Me.DBMaintenancePanel.Controls.Clear()

Dim I As Integer
For I = 0 To MyCustomIngredients.Count - 1
MyDBItemCheckBox = New CheckBox
MyDBItemCheckBox.AutoPostBack = True
MyDBItemCheckBox.Checked = True
'MyDBItemCheckBox.EnableViewState = False
MyDBItemCheckBox.ID = "D" & I.ToString
MyDBItemCheckBox.Text =
MyCustomIngredients(I).Description
AddHandler MyDBItemCheckBox.CheckedChanged, AddressOf
ADBItemCheckChanged
Me.DBMaintenancePanel.Controls.Add(MyDBItemCheckBo x)
Me.DBMaintenancePanel.Controls.Add(New
LiteralControl("<br />"))
Next
End Sub

Public Sub ADBItemCheckChanged(ByVal sender As Object, ByVal e
As EventArgs)
Me.IngredientsPanel.Visible = False
Me.DBMaintenancePanel.Visible = True
Me.OUTPUTLabel.Visible = False
Me.ItemsDropDownList.SelectedIndex = 0
Me.DBMaintenanceButton.Visible = False
Me.FinishDBMaintenanceButton.Visible = True
Me.ADDButton.Enabled = False

Dim MyDBItemCheckBox As CheckBox = DirectCast(sender,
CheckBox)

Dim MyDataBase As New SqlDataProvider
Dim MyCustomIngredients As New List(Of CustomIngredients)

'1) Load list of items from database
MyCustomIngredients =
MyDataBase.SelectAllCustomIngredients(UserId)

'2) Remove unchecked item from database

MyDataBase.DeleteCustomIngredient(MyCustomIngredie nts(CInt(MyDBItemCheckBox.ID.Trim("D"))))
End Sub

PS: I am using Visual Web Developer 2005 Express.
Aug 13 '08 #1
0 1284

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

Similar topics

0
3717
by: Frank Collins | last post by:
Can anyone point me to some good examples on the web of using values from dynamically created checkboxes on forms in ASP, particularly relating to INSERTING those values into a SQL or Access...
6
4476
by: middletree | last post by:
I have a page which has something like 100 checkboxes, in three categories, so I chose to build the checkboxes into the page like this: <% strSQL = "SELECT PeopleID, PeopleDesc " strSQL =...
1
1608
by: middletree | last post by:
Hate to post this in a separate post, but felt that the last thread was too far down to get noticed. It is called dynamic checkboxes, and it contained some good advice for me, but it led to...
8
2810
by: DylanM | last post by:
I have some checkboxes that are generated from the results of a database search. At the moment, the checkboxes are part of a table making up a form. Users are going through the form, clicking the...
7
1923
by: pizzy | last post by:
PROBLEM: I CAN'T GET THE LAST RESUTS TO WORK CORRECTLY. I WOULD PROVIDE THE CODE (AND WILL IF REQUESTED). BUT IN MY OWN WORDS I AM TRYING TO HAVE THE FIRST FORM DYNAMICALLY CREATE INPUT BOXES...
10
4577
by: Steven | last post by:
I create the checkboxes dynamically on my webform (aspx). after I create them, when I check any of the checkboxes, nothing happens. Here is my code ... ArrayList LayerNameList1 = LayerNameList;...
0
1147
by: louise raisbeck | last post by:
Hi there, I am databinding a datagrid on the onload with the usual !IsPostBack condition. I have to create some dynamic checkboxes, because i dont know how many i will need until the dataset...
1
2435
by: tamari | last post by:
I have a strange problem changing the checked value of dynamically created checkboxes within code. This is what is happening. Depending what is selected I create checkboxes within a panel. These...
2
4868
by: scottSD | last post by:
Hi everyone. this is my first post here, but i've found quite a bit of great information from reading the forums in the past. i'm not sure if what i'm trying to do is possible or not, but here it...
0
7202
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
7084
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...
0
7328
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
7458
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
5578
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,...
1
5013
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...
0
4672
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...
0
1512
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 ...
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.