Postback problem - datagrid not refreshing

B

b_naick

In my Page_load I call a function called ShowUsers if its not a
postback. i.e

if (!Page.IsPostBack) {
ShowUsers();
}

ShowUsers reads a db table, and binds the reader to a datagrid.

On the page I also have some textbox fields - userid, name, email etc,
and a button called SaveUser.

SaveUser_Click is implemented as follows:

if (Page.IsValid) {
db query to add user to table;
confMsg.Text = "User Added Successfully";
ShowUsers();
}

So, when a new user is added, the data should be written to the db and
then the datagrid should be updated, right?

Doesn't happen. I have verified that the new user is in teh db, and the
label is correctly displays a success message. But the datagrid doesn't
refresh.

What am I doing wrong??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top