I've got a page with a couple ascx files on it. One od the controls displays
a user's picture, the other contains a datagrid where a user can upload more
pictures, change their default picture, etc.
When a user selects a different picture in the contorl containing the
datagrid, the code execute when the page postsback, but the control that
displays the user's picture does not.
How do I get this control to refresh on a post back?
Thanks for your help
tomh - 19 Jul 2005 22:02 GMT
Steve Lutz - 23 Jul 2005 12:20 GMT
Are you saying that after a postback, the control that displays the user's
picture doesn't update (to the new picture for example)?
This is probably an event sequencing problem. When doing a postback, you
need to look at the events that are called:
(summarized, not complete list:)
1) Page OnLoad
2) Controls' Page OnLoad
3) PostBack event
If you notice, your postback event handler, which is where I imagine you are
modifying the picture, is called after the control's page load. Therefore
your control is rendering the correct image, you just changed it AFTER the
control did it's processing.
To fix this, I suggest moving your control's PageLoad functionality to an
OnPreRender event handler instead of the OnLoad handler. This may have
further implications depending on your code though. But for simple custom
controls it doesn't.
HTH
Steve
> I've got a page with a couple ascx files on it. One od the controls
> displays
[quoted text clipped - 9 lines]
>
> Thanks for your help