11 Answers, 1 is accepted
Thank you for the questions.
There is a simple solution for this task - just set the AddNewRow position to Bottom:
this.radGridView1.MasterGridViewTemplate.AddNewRowPosition = PinnedRowPosition.Bottom; |
Hope this suits your scenario. Write me back if you have other questions.
Regards,
Martin Vasilev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Thanks for the reply but this will just add to the bottom every time, which is fine but I would like the grid to move to a new row when on the last column of the last row. Currently the grid stays on the last column and stays there when I tab.
Thanks for your help,
Derek.

Thank you for getting back to me.
You can implement adding new row behaviour, by using custom GridBehaviour class. You have to override ProccessTabKey method and create custom RadGridView class that implements your custom GridBehaviour . This approach was demonstrated in attached example project.
Do not hesitate to contact me again, If you need additional assistance.
Greetings,
Martin Vasilev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Thanks for the solution, however, it counts all columns rather than just the ones that are visible. Therefore the solution won't work. Is there a wa to count the visible columns?
Thanks,
Derek.

public
override string ThemeClassName
{
get
{
return typeof(RadGridView).FullName;
}
}
I get an error with ThemeClassName: "Error 3 'Public Overrides ReadOnly Property ThemeClassName() As String' cannot override 'Public Overridable Property ThemeClassName() As String' because they differ by 'ReadOnly' or 'WriteOnly'. C:\development\CRM\CRM\Classes\CustomRadGridView.vb 18 40 CRM
"
and with RadGridView: "Error 4 'RadGridView' is a type and cannot be used as an expression. C:\development\CRM\CRM\Classes\CustomRadGridView.vb 20 33 CRM
"
Any Ideas?
Thanks

Forgot to mention i tried in VB.net:
Public
Overrides ReadOnly Property ThemeClassName() As String
Get
Return Type.GetType(Telerik.WinControls.UI.RadGridView).FullName
End Get
End Property
and I get the two errors above. Is this going to be a property of the radgridview in a future release? Most other grids have it.
Please find as attachment the same example in VB.Net which includes some custom logic about handling the case when the last columns is hidden.
If you have other questions, do not hesitate to contact me again.
Best wishes,
Martin Vasilev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.


Since Expression columns are read only you simply should skip them in the CheckIfLast method. For example:
private
bool
CheckIfLast()
{
if
(
this
.GridControl.CurrentCell.RowIndex ==
this
.GridControl.RowCount - 1)
{
if
(
this
.GridControl.CurrentCell.ColumnIndex ==
this
.GridControl.ColumnCount - 1)
{
return
true
;
}
else
{
for
(
int
i =
this
.GridControl.CurrentCell.ColumnIndex + 1; i <
this
.GridControl.ColumnCount; i++)
{
if
(
this
.GridControl.Columns[i].IsVisible && String.IsNullOrEmpty(
this
.GridControl.Columns[i].Expression))
{
return
false
;
}
}
return
true
;
}
}
else
{
return
false
;
}
}
A bit off topic, please ask the person who has purchased our controls in your company to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system. Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: www.telerik.com/account/faqs.aspx.
Best wishes,
Martin Vasilev
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.