4 Replies - 415 Views - Last Post: 02 May 2019 - 08:55 AM

#1 DarenR   User is offline

  • D.I.C Lover

Reputation: 634
  • View blog
  • Posts: 4,218
  • Joined: 12-January 10

any reason why a list would become empty on post back

Posted 01 May 2019 - 06:02 AM

i have to store info on a list
on button click more info may be added to the list
it works fine the 1st click then after that the list becomes nothing again


here is the code i have:

global

dim _testList As List(Of TableRow)



in Page_LoadComplete

if IsPostBack
                callTheLoad()
            End If
            if _testList is nothing then
            else
                For Each r As Object In _testList
                    reasonsTable.Controls.Add(r)
                Next
            end if



in call the load:

 if _testList Is Nothing   Then
            _testList = new List(Of TableRow)
            _testList.add(row)
        Else
            _testList.add(row)
        End If



that is it nothing more yet on post back after button click it sets the list to nothing

thoughts?

Is This A Good Question/Topic? 0
  • +

Replies To: any reason why a list would become empty on post back

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15357
  • View blog
  • Posts: 61,571
  • Joined: 12-June 08

Re: any reason why a list would become empty on post back

Posted 01 May 2019 - 11:59 AM

Where is this information being added or stored?

Typically I work on the assumption a postback is there to ruin everything so anything I need to show I load.. and anything I want to load better be saved into a DB table.
Was This Post Helpful? 0
  • +
  • -

#3 DarenR   User is offline

  • D.I.C Lover

Reputation: 634
  • View blog
  • Posts: 4,218
  • Joined: 12-January 10

Re: any reason why a list would become empty on post back

Posted 02 May 2019 - 07:28 AM

it's for that awesome program-- ha

im going to use javascript to create the rows dynamically
now the issue i am having is how to populate the next set of drop downs on row add
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15357
  • View blog
  • Posts: 61,571
  • Joined: 12-June 08

Re: any reason why a list would become empty on post back

Posted 02 May 2019 - 07:30 AM

So much ajax and jquery in your future.

... or scrap it and make it a java applet!
Was This Post Helpful? 0
  • +
  • -

#5 DarenR   User is offline

  • D.I.C Lover

Reputation: 634
  • View blog
  • Posts: 4,218
  • Joined: 12-January 10

Re: any reason why a list would become empty on post back

Posted 02 May 2019 - 08:55 AM

so after trying javascript i realized that it would still need to post back to get the drop down information-- so i guess i am back to the original way i was trying to get it work.

now the issue i have is that the information entered is not being stored -- not really sure how to get said information from the dynamic controls either-- -any thoughts?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1