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

How to Parse through every GridViewRow's DataContext? For DispatcherTimer's Tick method

4 Answers 95 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Syed Nadeem
Top achievements
Rank 1
Syed Nadeem asked on 30 Apr 2010, 06:55 AM
Hi,

I would like to do something similar what we do in ASP.NET where we parse through all the rows in a GridView and assign a particular value to a particular cell in a row which has a matching TaskId as the current Id.

This has to happen in a Tick function of a Dispatcher Timer object. Since I have a Start Timer button Column for every row in a GridView. Upon a particular row's Start Timer Button click, I have to start its timer and display in a cell in that row. Similarly there can be multiple timers running in parallel.

For this I need to be able to check the task Id of the particular task and keep updating the cell values with the updated time in all of the tasks that have a Timer Started.

TimeSpan TimeRemaining = somevalue;
string CurrentTaskId = "100";
foreach(GridViewRow row in RadGridView1.Rows) // Here I tried  RadGridView1.ChildrenOfType<GridViewRow>() as well but it has null
{
if(    (row.DataContext as Task).TaskId == CurrentTaskId )
row.Cells[2].Content = a.TaskTimeRemaining.ToString();
}

Can someone please let me know how do I get this functionality using the Telerik RadGridView?

Cheers,
Syed.

4 Answers, 1 is accepted

Sort by
0
Syed Nadeem
Top achievements
Rank 1
answered on 30 Apr 2010, 11:33 AM
I found the answer to my Question on this thread

Thanks to Milan for being a savior :).

Cheers,
Syed Nadeem.
0
Syed Nadeem
Top achievements
Rank 1
answered on 30 Apr 2010, 12:49 PM
Hi,

 I have an issue here. My timer has an incrementor value set to 1 second. When the timer is started, if I scroll to the right end of my GridView and scroll back to the left end, it blanks my timer cell and refreshes the next second with the next Tick value.

But the issue is when I have stopped my timer it displays the current value of the timer. Here if I repeat the scroll to the right and back, the cell loses its value and shows blank :(.

Did any of you face the same issue? If yes any solution or reasoning why it happens so?

Cheers,
Syed
0
Maya
Telerik team
answered on 30 Apr 2010, 03:00 PM
Hi Syed Nadeem,

In order to provide you with a possible solution for your case, it would be best to send us your project. As we can conclude from your explanation, the problem is probably with virtualization, but we will be able to help you more, if we have the code of your project.

Sincerely yours,
Maya
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Syed Nadeem
Top achievements
Rank 1
answered on 05 May 2010, 09:17 AM
Hi Maya,

I have opened a ticket with the #:306839 with the details of the solution. I would be glad if you could respond soon.

Cheers,
Syed Nadeem.
Tags
GridView
Asked by
Syed Nadeem
Top achievements
Rank 1
Answers by
Syed Nadeem
Top achievements
Rank 1
Maya
Telerik team
Share this question
or