Post back events...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a small application that adds into a database, users.

I have a textbox and a button, and when a user enters a name and click into
the button i add into the database the username...

For other hand i have in the same aspx page a list box. (i would like to use
it to put each user that i add into the database).


My problem its that when i click the button and the user its inserted the
user is added into the database but the list box dont show this new user. But
if i refresh the page the new user appears in the list box...

OnInit Method
- Put users from database in the listbox


OnClick Method
- Add into the database this user...

What its the best way to obtain everytime i click the button one add into
the database and then show the users?
 
Josema,

One way to accomplish this is to abstract the binding of the listbox into a
method. Then upon initialization and after the insert call this method. The
method will basically query the db and then bind the data to the listbox.

I hope this helps.
------------------------
 
Hi,

You have two options:

1- rebind the listbox each time that a new user is added. ( the best way
!!! )
2- just insert the new user manually in the listbox ( not the best way
!!!! )

Cheers,
 
Back
Top