Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2005

Tip: Looking for answers? Try searching our database.

Need help with custom Web Controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tperri - 19 Jul 2005 19:47 GMT
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
Could you post the code?
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.