Why does a button click reset my datalist?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Why does a button click reset my datalist?

  1. #1
    Join Date
    Jul 2005
    Posts
    1

    Why does a button click reset my datalist?

    In my application I cannot seem to get anything but button clicks to trigger any procedures. So, I've been using buttons. However, when I use a button to grab the selectedvalue of a datalist control it seems to reload the page and therefore resets the datalist and I get the first entry on the list back instead of the entry I've choosen.

    I'm new to browser based development, can someone explain this to me?

    D Everett

  2. #2
    Join Date
    Dec 2003
    Posts
    2,750
    It's probably because you're doing a postback to the server when you click your button and it's rebuilding your DataList. You should check for this in your Page Load event and then re-select the item (that was previously selected) in code.
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

Similar Threads

  1. Replies: 2
    Last Post: 05-16-2005, 10:22 AM
  2. Simulating button click event
    By Rich Golem in forum .NET
    Replies: 2
    Last Post: 04-14-2002, 10:07 PM
  3. Connecting to DB2 using VB 6.0
    By Randy in forum VB Classic
    Replies: 5
    Last Post: 03-30-2001, 09:13 PM
  4. How to simulate button click?
    By Serge in forum VB Classic
    Replies: 6
    Last Post: 06-14-2000, 06:07 AM
  5. How to simulate button click?
    By Serge in forum VB Classic
    Replies: 0
    Last Post: 06-10-2000, 07:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center