This is a migrated thread and some comments may be shown as answers.

Getting grid editable row value in code behind on timer tick event

1 Answer 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pavan
Top achievements
Rank 1
Pavan asked on 01 Feb 2013, 07:36 AM

Hi All,

In our application we used telerik rad grid and timer control. Have a editable text box inside a grid. The timer interval is one min. In timer tick event I am saving grid data in to the session. There is around 500 lines in grid. There are two scenario .
 1.  Entered the value in editable text box of the grid. And check entered value from grid in code behind (in .cs file) am able to get all the values from the grid.
 2.  Entering the data in text box and continue till the end of the grid, meanwhile in the  middle timer tick event fires then I am not getting all editable rows value in code behind of the grid.

 Eg:       Grid contains 300 rows to be entered. After inserting value in 200 rows timer tick fires and try to save the data of 200 rows.
              But am able to get 130-150 rows of data in that timer tick event when try to read from grid data . In timer tick event i am using    this code to read the grid value in code behind.

foreach (GridItem item in grid.Items)
{
      RadNumericTextBox txtBox = (RadNumericTextBox)item.FindControl("txtBox");   
}

Kindly someone help me to resolve this issue. Thanks in advance.

Regards,
Pavan

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 05 Feb 2013, 03:53 PM
Hello Pavan,

A colleague of mine has already answered your support ticket and will place his response here as well, if somebody else have a similar scenario to yours.

When you have many records like 200 in your case and you need to foreach these records and then insert them to the database you may exceed the time limit of the Tick event. If the Tick event is fired while you are updating the records it may flush the unsaved data.

In this case you may need to reduce the number of records you insert or edit. This could be done either with some marker of the edited rows or by denying updating more than specified amount of rows. That is to say if you want to limit the edited number to 40 you may check before entering the item in edit mode whether the amount is more than 40 and only if it is not to allow the edit.

All the best,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Pavan
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or