• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 321
  • Last Modified:

Updating a Grid after a button has been clicked.

I am fairly new to ASP.NET programming, but not new to programming itself.  My problem seems to lie in how to handle the page life-cycle and how to make things happen in the order I need them too.

Here is my problem.  

I have a grid on a page, lets call it grid 2.   When a client selects a row on the grid it updates information in text boxes below.  The user makes changes to these and clicks on a button.  Now the button works fine and updates the underlying SQL database correctly.  My problem is that the grid is not getting updated until later on, when another selection is made.  

The order of operations appears to be ..

Page_Load
Button_Click - update happens here
Page_Render - I rebind the grid here but the grid is not updated on the screen.


The grid and the button are both Telerik Rad Controls.

Is there a way to make this work.  Do I need to use AJAX Panels or something that I am not grasping yet ?

Thank you for any input.
0
vossjck
Asked:
vossjck
  • 2
1 Solution
 
ddayx10Commented:
I'm hoping the obvious answer isn't a "can of worms", but in short you need to re-bind the grid right after the update(during the button_click) event.

If you are looking to "only bind once" to simplify code then you may be able to bind in the Page_PreRender event, but this may have implications on dynamic controls you may have added during binding and their associated events.

By the time you get to the Page_Render event all the important details regarding your control's make-up have been made. Unless you have some really important reason, bind after the update during the click event.

Here's an old, but easy to follow article about page life-cycle that may help improve your understanding, although it is an admittedly large and complex model to understand.

http://www.c-sharpcorner.com/UploadFile/Santhi.M/ASP.NETLifeCycle11282005043446AM/ASP.NETLifeCycle.aspx
0
 
vossjckAuthor Commented:
I do the "rebind" right after the button click,  but the grid does not update on the screen.   I've also tried to rebind after the prerender, but the grid still does not update the data displayed on the screen.  Not until another page_load event is triggered.
I am wondering if, because it is a Telerik grid that this has something to do with it.  I had this problem with another Telerik control where certain items were unalbe to change after the page_load.  
0
 
ddayx10Commented:
I'm sorry you could post your code, but alas the telerik controls are not in my repertoire. I cursory research foray tells me the telerik grid is a very specialized beast. If I were you I'd post my issue in the telrik forum or repost this question clarifying that you are using a telerik grid(preferably in the subject heading) and with some code samples.

Radgrid not updating ex.
http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-not-updating.aspx
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now