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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesI lost objects instance on button clickI lost objects instance on button click
Previous
 
Next
New Post
10/29/2010 4:44 AM
 
I'm building a module to manage a simply data entry on my application based on a dnn framework. The module contains many controls, like lists and combos , now, for example, when I click on a button to validate a list element the module raises a reload event and I lost every values of the lists.
Could you help me to solve this?
 
New Post
10/29/2010 9:51 AM
 
If you are dynamically adding controls, make sure that you are loading them at the right point in the page lifecycle so they can be re-loaded from viewstate.

-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
10/29/2010 5:17 PM
 
First of all thankyou for your quick reply and my apologize If I didn't explain exactly the problem in the last post.
Anyway, each controls inside the module mantain the values after the reload event but all the variables and the objects are set to nothing.

This is anof my code;

I build a class called MyList
---------------------------------------------------------------------------------------------------------------------------
Class Mylist
Private _ID As Integer
Private _Code As String
Private _Name As String
Public Property ID() As Integer
Get
Return _ID
End Get
Set(ByVal Value As Integer)
_ID = Value
End Set
End Property
Public Property Code() As String
Get
Return _Code
End Get
Set(ByVal Value As String)
_Code = Value
End Set
End Property
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal Value As String)
_Name = Value
End Set
End Property

Public ReadOnly Property CodeName() As String
Get
Return _Code & " - " & _Name
End Get
End Property
End Class
---------------------------------------------------------------------------------------------------------------------------

In button3 click I load a list as MyList and I set that as a datasource of a combo

---------------------------------------------------------------------------------------------------------------------------

Private newList As List(Of MyList)
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click
Dim ml As Mylist
newList= New List(Of MyList)
ml = New Mylist
ml.ID = 1
ml.Code = "A"
ml.Name = "AAA"
newList.Add(ml)
md = New ModalitaDimissione
md.ID = 2
md.Code = "B"
md.Name = "BBB"
newList.Add(ml)
md = New ModalitaDimissione
md.ID = 3
md.Code = "C"
md.Name = "CCC"
newList.Add(ml)


Combo1.DataSource = newList
Combo1.DataTextField = "Name"
Combo1.DataBind()
End Sub
---------------------------------------------------------------------------------------------------------------------------Everything works fine; the combo load each elements and mantains all the values when the reload event is raised after the Button control is clicked. But if I control in debug the value of newList after the reload it's set to nothing
---------------------------------------------------------------------------------------------------------------------------

Protected Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button4.Click
stop
TextBox2.Text = new(1).Code
End Sub
End Class
------------------------------------------------------------
There is a way to preserve all the values of the objects and the variables after the reload?
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesI lost objects instance on button clickI lost objects instance on button click


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