Multiple user controls not reloading properly

M

Mark

Hi everyone,

I have two user controls on a webform that display overlapping
information but each in quite different ways. One of the controls can
update information in the database and the other one displays some of
that information.

The first control saves back to the database and the displays the new
information (obviously!) But the second control does not and after the
update is still displaying the old info.

How do I make the whole schebang refresh? I know I could probably just
redirect the user back to the same url but this seems unnecessary given
the amount of control you can exercise in dotnet. Is there a simpler
way?

Regards,
Mark
 
G

garethdjames

make sure you databind both controls after the postback to update the
database,

I suspect that the second control is using viewstate to render its data
 
M

Mark

Thanks for the quick reply ;)

However, how does the second control know when to databind? At the
moment the second control does its initial databind its page_load
event. But I have defined no other events in the control.

I think I need a way of specifying that the second control should be in
some way "dependant" on the first. I've thought about firing an event
in the first control and then registering the second to catch it but
does that not seems cumbersome?

Thanks again
 
G

garethdjames

are you checking for Page.isPostBack ?

you might not be rebinding the second data grid after doing the update,

Zip up the code and mail it to me and I'll take a look
 
M

Mark

Hi and thanks for the help.

I've found a new event that seems to be doing the trick. Its the
OnDataBinding event.

If I call don't worry about loading any data in the PageLoad event and
just make the call to DataBind and if I load the data in this data
binding event instead then it doesn't matter where I call DataBind
from, the data will always be loaded.

Anyway, it probably seems a bit confusing as to what I'm doing, but
your reply was useful because it put me on a slightly different path.
Thanks muchly,

Mark
 

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,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top