Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Refresh UserControl/Page load order

Avatar of Aluedke
Aluedke asked on
.NET ProgrammingC#ASP.NET
3 Comments1 Solution2556 ViewsLast Modified:
I have a gridview that loads a list of data from my database based off a value in the querystring.  The data is bound to the gridview in the page_load event in c# code behind and through paging is set to display 1 item at a time.  In my ASP.NET page, I have a user control that loads a set of comments based off a unique ID for the item loading in my gridview.  I also have a custom pager with prev and next links to page through my gridview.  

When I load the page from a link, my gridview fields and comments usercontrol load fine.  My problem appears when I page through the records. Because of the load_page order, my gridview is bound and it triggers my onDataBound, onRowDataBound functions and sets my value to load my comments user control (again separate from gridview in page) for the previous value (when paging).  The onIndexChanging event is than fired which updates the gridview to the new value with a new databind, but fails to reload my usercontrol.  

My problem is that I can't reload/refresh my user control and as result it always shows the comments for the previous record.

Is there a way to manually reload the usercontrol?  Or is there a better way to organize my load events to ensure that the usercontrol is always bound before the page is drawn-more specifically bound after the onIndexChanging function is triggered.  

Any help would be appreciated.  
Avatar of kruegerste
kruegersteFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answers