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

Q2 Gridview Changes

8 Answers 235 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 14 Jul 2010, 05:01 PM
I am trying to implement the new Q2 controls and am having the following issues with the GridView:

1) I have a routine that changes a regular GridViewTextBoxColumn to a GridViewCheckBoxColumn.  Because in the previous grid, you couldn't just change the type of the column, I had to record the column index, remove it, create a new GVCBC and set the index of it.  The index property is no longer settable.

2) I have a method that lets me programatically set the selected row.  I used to say SelectedRows.Clear() and then Rows[x].Selected = true;  Now the Clear() method is missing from the SelectedRows collection.

Thanks in advance,

Lars Solberg

8 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 15 Jul 2010, 02:22 PM
For the clear you can use
Snippet
            this.radGridView1.ClearSelection();
            this.radGridView1.CurrentRow = null;

I still haven't found a workaround for the index...

But i have a different question how can we select multiple lines programmatically? before it was SelectedRows.Add(Row)...
0
Jack
Telerik team
answered on 20 Jul 2010, 10:18 AM
Hello Lars Solberg,

Thank you for the constructive feedback. We appreciate that. 

Regarding your questions:

1. We found that the Index property sometimes confuses our customers. This is why we decided to make it read only. You should use Columns.Move method instead:

this.radGridView1.Columns.Move(5, 3);

2. We are always trying to keep our new API similar to the Microsoft DataGridView API. This gives our customers flexibility and they can easily switch from MS grid to RadGridView. Because of this we changed the selected rows collection to be a read only collection. As Emanuel said, you can use the ClearSelection method.

I hope this helps. I also updated your Telerik points for the feedback. Should you have any questions, do not hesitate to ask.

All the best,
Jack
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
Emanuel Varga
Top achievements
Rank 1
answered on 20 Jul 2010, 11:29 AM
Hello again,

I opened a support ticked on the selected rows issue as well, because it's working in some of the cases but i can give you a specific example in which is not working properly:

If you select a row in the grid, call a ClearSelection() and after that add a new row, the newly added row is always selected, why?

If we take into consideration a system that receives data continuously this will cause the scrollbar to be stuck at the highest level.

Thank you,
Emanuel
0
Jack
Telerik team
answered on 20 Jul 2010, 05:31 PM
Hello Emanuel Varga,

In single selection mode the CurrentRow is always synchronized with the SelectedRows collection. The SelectedRows collection contains only one row, which is always the CurrentRow.

Please, give me more details on your scenario and the exact behavior that you want to achieve. I think that I can find a proper solution for you. I am looking forward to your reply.

Sincerely yours,
Jack
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
Emanuel Varga
Top achievements
Rank 1
answered on 20 Jul 2010, 05:38 PM
Hello Jack,

I have explain everything i think in the support ticked with id: 328768 .
And there is also a code example there, if you can please take a look at that and let me know if there is any other solution for this or is this a really annoying bug...

And again i will write here the example scenario if anyone else is interested:

1. Bind the grid
2. Add a new row to the grid
3. Select that row
4. Programatically call ClearSelection() and .CurrentRow = null; => no rows appear to be selected
5. Add a new row and that new row will be selected, why?
6. If data is being received, in a situation in which you are using the grid for monitoring purposes : this happened, that happened, ( first line in, last line out) if this happens you will always be stuck with the scrollbar on the first line and you won't be able to move it from there.
You can try in the example i've provided in the ticket.

Hope this is clear
Thank you,
Emanuel, Varga

0
Svett
Telerik team
answered on 22 Jul 2010, 12:04 PM
Hello Emanuel Varga,

You can find the answer of your question in your support ticket. If you have further questions do not hesitate to write us back.

Best wishes,
Svett
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
Emanuel Varga
Top achievements
Rank 1
answered on 22 Jul 2010, 12:13 PM
Hello Svett,

I don't have any new answer to my support ticket can you please take another look or at least tell me if it's working for you or not

Thank you,
Emanuel Varga
0
Svett
Telerik team
answered on 26 Jul 2010, 05:24 PM
Hi Emanuel Varga,

Please refer to the answer given in Ticket ID 328768. The reason for the issue is the fact that RadGridView determines the current and selected row asynchronously, because of performance optimizations. Hence, when you add records through your data source, you need to invoke the Application.DoEvents method immediately after that and before clearing the selection. This will cause all pending events to be processed.

Kind regards,
Svett
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
Tags
GridView
Asked by
Dan
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Jack
Telerik team
Svett
Telerik team
Share this question
or