Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

DotNetNuke Marketplace
  Ads  
Engage Software - Training Partner for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

The Official Microsoft ASP.NET Website
Portal Webhosting - Hosting For Developers
Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Incorrect sender object from dynamic checkboxes in DNN module
Previous Previous
 
Next Next
New Post 8/12/2008 2:31 PM
User is offline Johan Van der Galien
14 posts
10th Ranked


Incorrect sender object from dynamic checkboxes in DNN module 

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 9:45 AM
User is offline Johnny Li
87 posts
10th Ranked


Re: Incorrect sender object from dynamic checkboxes in DNN module 

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 Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Incorrect sender object from dynamic checkboxes in DNN module
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Venexus, Inc.
Need custom a custom DotNetNuke module? From module planning to deployment, including training and support, Venexus developers deliver end-to-end web solutions on time and on budget.
www.venexus.com
Bring2mind
Document Centric DNN Module Solutions
www.bring2mind.net
WEBPC™ DotNetNuke® sites for Small Business
WEBPC™ are internet consultants and web hosters catering to the small business market.
www.webpc.biz

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP