When you use var, object is assumed. Of course, the object contains a GridViewCellInfo, but you have to cast it first to use one of its members.
The goal is to prevent unnecessary casts.
When the columns are auto-generated, the way to modify the columns is to use the Columns collection. We could expose an event that will be called when the columns are auto-generating. From the event arguments, we could get the newly created column and replace with if needed or modify it. Similar to the CreateRow event of the control.
Please refer to the below gif file. You will notice that the drop row line is shown only when dropping in the same grip but not when dropping on another grid:
Workaround: use the project in the following forum post: https://www.telerik.com/forums/preview-drop---drag-drop-between-gridview#5477699
Good afternoon,
I was wondering if anyone could help me with a GridView export issue I am having.
I am populating a GridView from an SQL query. This table has two DateTime columns that I am formatting after the DataBindingComplete to show the milliseconds portion of the DateTime field like so:
private
void
dgvTransTable_DataBindingComplete(
object
sender, GridViewBindingCompleteEventArgs e)
{
for
(
int
j = 0; j <
this
.dgvTransTable.Columns.Count; j++)
{
if
(
this
.dgvTransTable.Columns[j].GetType() ==
typeof
(Telerik.WinControls.UI.GridViewDateTimeColumn))
{
((GridViewDateTimeColumn)
this
.dgvTransTable.Columns[j]).FormatString =
"{0:MM/dd/yyyy hh:mm:ss.fff}"
;
}
}
}
Works great. Column displays just like I want. Now the problem is with the Excel Export. Normally with the format cell options, you can use .000 for milliseconds. I just can't seem to get it correct with the GridViewSpreadExport. This is what I am trying, note I've also tried using the .fff but it both cases, all that is written to the Excel cell is the short date/time string, and the formatting looks like I want, except either just the literal .fff or .000 show up in the visual cell.
I'd even be happy if someone knows how to make this field export as a straight text field as long as the string is formatted like the gridview cell.
foreach
( GridViewDataColumn col
in
dgvTransTable.Columns )
{
switch
( col.DataType.Name )
{
case
nameof(DateTime):
col.ExcelExportType = Telerik.WinControls.UI.Export.DisplayFormatType.Custom;
col.ExcelExportFormatString =
"MM/dd/yyyy hh:mm:ss.000"
;
break
;
}
}
I might be missing something, but I have Hyperlinks in a column in my RadDatGridView.
I tried searching for a Support document explaining this, but didn't find any.
When the grid is exported to excel all data is coming across, but the column with hyperlink is not
a hyperlink in Excel.
Below is sample of the code used to make the "HyperLink" column in my grid.
radGridView1.DataSource = dtResults;
radGridView1.Columns.Remove("Path");
GridViewHyperlinkColumn col = new GridViewHyperlinkColumn();
radGridView1.Columns.Insert(5, col);
col.Width = 200;
col.FieldName = "Path";
col.HeaderText = "Path";
col.Name = "Path";
Coded used to do the Export....
GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1);
spreadExporter.ExportVisualSettings = true;
SpreadExportRenderer exportRenderer = new SpreadExportRenderer();
spreadExporter.RunExport(filename, exportRenderer);
Thanks.
Roger
This was working this way in 2017 then we changer it so all rows are affected. Bot modes should be supported.
Add a new property AllowSelection/EnableSelection in order to control whether the use can select a cell/row. Workaround: Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.ProductsTableAdapter.Fill(Me.NwindDataSet.Products) Me.RadGridView1.CurrentRow = Nothing AddHandler Me.RadGridView1.SelectionChanging, AddressOf Grid_SelectionChanging AddHandler Me.RadGridView1.CurrentRowChanging, AddressOf Grid_CurrentRowChanging End Sub Private Sub Grid_SelectionChanging(sender As Object, e As Telerik.WinControls.UI.GridViewSelectionCancelEventArgs) e.Cancel = True End Sub Private Sub Grid_CurrentRowChanging(sender As Object, e As Telerik.WinControls.UI.CurrentRowChangingEventArgs) e.Cancel = True End Sub