Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Bill Howell   on Aug 04 In Asp.net Category.

  
Question Answered By: Nicolas Costa   on Aug 04

It seems like the datatable  object "dt" isn't getting persisted on postback.
You're initializing it (by doing the dataadapter.fill) in btnadd_Click( ) -
which occurs during one round trip, but then you're later referencing it in
IndexChanged( ) - which executes during a different round trip. In order
for the datatable object  to have data, you'll need to either fill  it from
the database again, or you'll need to stick it into cache/session
variable/or viewstate after you've filled it the first time. Then when you
want to pull data  out of it in IndexChanged( ), you'll first need to
re-populate it from whichever persisting method  you've used...

Share: