Hello. I am evaluating the Q1 2008 SP1 version of the RadGrid.
After updating the datatsource of the grid, I have been trying to deselect the current row so that it is not highlighted. I seem to have tried every suggestion on this forum, but to no avail. Here is what I have tried (in VB):
RadGridView1.CurrentRow.IsCurrent = False
RadGridView1.CurrentRow = Nothing
RadGridView1.MasterGridViewInfo.CurrentRow = Nothing
RadGridView1.GridElement.Update(True)
These don't work. How can I deselect a row?
Thanks,
David
After updating the datatsource of the grid, I have been trying to deselect the current row so that it is not highlighted. I seem to have tried every suggestion on this forum, but to no avail. Here is what I have tried (in VB):
RadGridView1.CurrentRow.IsCurrent = False
RadGridView1.CurrentRow = Nothing
RadGridView1.MasterGridViewInfo.CurrentRow = Nothing
RadGridView1.GridElement.Update(True)
These don't work. How can I deselect a row?
Thanks,
David
12 Answers, 1 is accepted
0
Mike
Top achievements
Rank 1
answered on 27 May 2008, 08:08 PM
David,
by chance have you tried clearing the selectedrows collection of the gridview?
by chance have you tried clearing the selectedrows collection of the gridview?
RadGridView1.SelectedRows.Clear()
0
David
Top achievements
Rank 1
answered on 27 May 2008, 08:57 PM
That does not work either. The row is still highlighted.
Thanks for the try, Mike!
Thanks for the try, Mike!
0
Hello David,
Thank you for writing.
I could not reproduce the behavior you've described. Maybe there is something specific to your scenario that is causing the issue. Please, could you provide me with a more detailed description and source-code fragments from your project?
I am looking forward to your reply.
Greetings,
Martin Vasilev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for writing.
I could not reproduce the behavior you've described. Maybe there is something specific to your scenario that is causing the issue. Please, could you provide me with a more detailed description and source-code fragments from your project?
I am looking forward to your reply.
Greetings,
Martin Vasilev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
David
Top achievements
Rank 1
answered on 28 May 2008, 01:52 PM
Sure, but which line of code (from above) is supposed to do the trick?
Here is my code. It seems pretty straight forward to me:
Sub refreshDataGridView() | |
Dim strSQL As String = "SELECT * FROM Inventory" | |
Dim da As Data.SqlClient.SqlDataAdapter = New Data.SqlClient.SqlDataAdapter(strSQL, connectionString) | |
Dim ds As Data.DataSet = New Data.DataSet | |
da.Fill(ds, "Inventory") | |
dt = ds.Tables("Inventory") | |
RadGridView1.DataSource = dt | |
RadGridView1.Columns("ItemID").IsVisible = False | |
RadGridView1.Columns("Category").IsVisible = False | |
RadGridView1.Columns("Supplier").IsVisible = False | |
RadGridView1.Columns("SupplierPartNum").IsVisible = False | |
RadGridView1.Columns("Manufacturer").IsVisible = False | |
RadGridView1.SelectedRows.Clear() | |
End Sub |
Any thoughts?
David
0
Hello David,
Thank you for sending your code.
I have replaced this line:
RadGridView1.SelectedRows.Clear().
with the one below:
Me.RadGridView1.CurrentRow.IsCurrent = False
With the code changed as shown above, the row is properly deselected. Please use this approach, and let me know if you need any further assistance with this task.
I am looking forward for your response.
All the best,
Martin Vasilev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for sending your code.
I have replaced this line:
RadGridView1.SelectedRows.Clear().
with the one below:
Me.RadGridView1.CurrentRow.IsCurrent = False
With the code changed as shown above, the row is properly deselected. Please use this approach, and let me know if you need any further assistance with this task.
I am looking forward for your response.
All the best,
Martin Vasilev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
David
Top achievements
Rank 1
answered on 31 May 2008, 04:25 AM
I have tried that line of code before, but it does not always work (per my first posting).
It seems to work when the routine is first called (on page load), but not any time after that.
Any thoughts?
David
It seems to work when the routine is first called (on page load), but not any time after that.
Any thoughts?
David
0
Hello David,
Thank you for getting back to us.
If you want to deselect the CurrentRow when the data source is changed, set its IsSelected property to false, as mentioned by Martin:
If you want to hide the current row in general, you should change the grid theme. This can be done by processing the RowFormatting event. Consider the following code snippet:
I hope this helps. Do not hesitate to contact me if you have other questions.
Regards,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for getting back to us.
If you want to deselect the CurrentRow when the data source is changed, set its IsSelected property to false, as mentioned by Martin:
Me.RadGridView1.CurrentRow.IsCurrent = False |
If you want to hide the current row in general, you should change the grid theme. This can be done by processing the RowFormatting event. Consider the following code snippet:
Private Sub radGridView1_RowFormatting(ByVal sender As Object, ByVal e As RowFormattingEventArgs) |
If e.RowElement.IsCurrent Then |
e.RowElement.DrawFill = False |
e.RowElement.DrawBorder = False |
End If |
End Sub |
I hope this helps. Do not hesitate to contact me if you have other questions.
Regards,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
David
Top achievements
Rank 1
answered on 02 Jun 2008, 02:08 PM
I'm sorry, I might not have made it too clear. I am just trying to de-select the row (remove the highlight)...not hide it.
Me.RadGridView1.CurrentRow.IsCurrent = False
Me.RadGridView1.CurrentRow.IsSelected = False
These both do not work individually or in tandem after the the original load.
Thanks,
David
Me.RadGridView1.CurrentRow.IsCurrent = False
Me.RadGridView1.CurrentRow.IsSelected = False
These both do not work individually or in tandem after the the original load.
Thanks,
David
0
Hello David,
Thank you for getting back to me.
I have tested different scenarios like described and I have discovered that there is an issue if you change existing DataSource of RadGridView.
In this case the following code:
Me.radGridView.CurrentRow.IsCurrent = False
is working but does not change the visualization. We will address this in one of the upcoming releases.
Currently, to avoid this undesired behavior please use the code below after changing the DataSource:
If you have other questions, do not hesitate to contact me again.
Greetings,
Martin Vasilev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for getting back to me.
I have tested different scenarios like described and I have discovered that there is an issue if you change existing DataSource of RadGridView.
In this case the following code:
Me.radGridView.CurrentRow.IsCurrent = False
is working but does not change the visualization. We will address this in one of the upcoming releases.
Currently, to avoid this undesired behavior please use the code below after changing the DataSource:
Me.radGridView1.CurrentRow = Nothing |
Me.radGridView1.GridElement.Update(Telerik.WinControls.UI.GridUINotifyAction.StateChanged) |
If you have other questions, do not hesitate to contact me again.
Greetings,
Martin Vasilev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
raju
Top achievements
Rank 1
answered on 12 Aug 2010, 02:11 PM
this information helped me a lot.
i have used the following for unselecting therow of grid.
gridview1.Currentrow.select=false;
thanks
i have used the following for unselecting therow of grid.
gridview1.Currentrow.select=false;
thanks
0
ankusha
Top achievements
Rank 1
answered on 07 Mar 2016, 04:04 PM
To deselect the row:
gridview1.SelectedIndex = -1
0
Hello ,
Thank you for writing.
In order to clear the selected rows in RadGridView, you can iterate the SelectedRows collection and deselect each row:
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik
Thank you for writing.
In order to clear the selected rows in RadGridView, you can iterate the SelectedRows collection and deselect each row:
for
(
int
i = 0; i <
this
.radGridView1.SelectedRows.Count; i++)
{
this
.radGridView1.SelectedRows[i].IsSelected =
false
;
}
I hope this information helps. Should you have further questions I would be glad to help.
Dess
Telerik
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 Feedback Portal and vote to affect the priority of the items