Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Incorrect sender object from dynamic checkboxes in DNN moduleIncorrect sender object from dynamic checkboxes in DNN module
Previous
 
Next
New Post
8/12/2008 4:31 PM
 

Dear Newsgroup Readers,

I have a problem with dynamic controls, in a DNN module, and event handlers in VB.NET ASP.NET 2.0. Events are firing and being handled
ONLY MOST of the time and also sometimes in a wrong way. I always unchecked the first of the list:

CheckBox1 sender ID = D0     
CheckBox2                         
CheckBox3                 
CheckBox4         
CheckBox5        

CheckBox2 sender ID = D1
CheckBox3
CheckBox4
CheckBox5

CheckBox2 sender ID = D0
CheckBox4
CheckBox5

CheckBox4 sender ID = D1
CheckBox5

CheckBox5 CheckChanged event does not fire the first time and must be unchecked again to remove


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 Enablev13wstat3 false and true for page, panel and dynamic checkboxes, no effect.)

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.Enablev13wstat3 = False
                MyDBItemCheckBox.ID = "D" & I.ToString
                MyDBItemCheckBox.Text = MyCustomIngredients(I).Description
                AddHandler MyDBItemCheckBox.CheckedChanged, AddressOf ADBItemCheckChanged
                Me.DBMaintenancePanel.Controls.Add(MyDBItemCheckBox)
                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(MyCustomIngredients(CInt(MyDBItemCheckBox.ID.Trim("D"))))
        End Sub

 

 
New Post
8/13/2008 11:45 AM
 

Kinder regards,


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!


Well the code works, but the timeline that you applied is wrong..

Run the sequence through step by step you should be able to come up with a solution.

To cut it short. Currently you are rendering the control then remove from database.
You need to show the controls after you remove them.

btw: the example you provide was misleading


CheckBox4 sender ID = D1
CheckBox5

CheckBox5 CheckChanged event does not fire the first time and must be unchecked again to remove


Following the previous sequence, you should have CheckBox4 left not CheckBox5 left.

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Incorrect sender object from dynamic checkboxes in DNN moduleIncorrect sender object from dynamic checkboxes in DNN module


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out