Postback in a page with a user control

I have a user control embedded in my C# .NET pages which forms a top navigation. Each page has the same top navigation. The problem is that I'm expected a postback to the page, not the navbar control when the user tries to navigate off a page. It is not doing this. How can I get a postback to the page to clean up and save data when the user selects the user control rather than a page control?
RosanneParnellAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

smolamCommented:
Hi,

Well from my understanding about what you are asking, you need to get the Usercontrol to have its own postback event when a link is clicked in it, so what I would suggest is that you add your own custom postback even when any link is clicked.  I found this article which may be of some use http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx, it tells you how to add your own postback event to a control.  What I would then do is use this or something similar with your controls to first do a postback that you will handle and save the data that you need to depending on which page the user is on.  Then also knowing which link the user has clicked on redirect them to the appropriate page.  If not you can buy custom navigation controls that can do all this for you!

HTH
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
msdixonCommented:
in your control you'll want to handle the Unload event of the control:

in the InitializeComponent method:

         this.Unload += new EventHandler(MyControl_Unload);

within your class:

      private void MyControl_Unload(object sender, EventArgs e)
      {
         // save data, cleanup, etc.
      }
0
msdixonCommented:
i say split the points
0
smolamCommented:
I agree!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.