I have a Telerik RadGrid, and there is a date column on the grid layout. The date format I am using to display date values is "dd/MM/yyyy". Then, I export that grid data to Excel file with GridExcelExportFormat.Biff type. The problem here is when I open the newly exported Excel file, the date format is changed to "MM/dd/yyyy".
I want to keep displaying my date format "dd/MM/yyyy" in the Excel file after exporting the grid data.
Unable to open "columns" sub-menu inside RadGrid's HeaderContextMenu on mobile devices. It does work on desktop PCs regardless of the OS.
Issue can be replicated starting with the version 2019 R1. Not present on previous versions (2017 and 2018 were tested)
Screenshot:
With form decorator the checkboxes jump a bit to the left when cell is opened: https://www.screencast.com/t/5HwXW6kgVhb Without form decorator they get centered because of the 100% width they get https://www.screencast.com/t/oxc75Bu6lM It comes from the combination of two things: - by default, the grid cells have a left padding (as well as padding to the other sides, but that's irrelevant now) - the batch editing container does not have left padding so the editable element can better align with the text in the general case (textboxes and other editable elements usually have some left padding). With a checkbox there is no textual input, though, and so it appears to shift to the left because the left-padding of the cell is removed by the batch editing. Workaround: <style> /* note: the margins may vary in different skins, inspect the rendering if there is a */ /* for form decorator */ html .RadGrid td.rgBatchCurrent .rfdCheckboxUnchecked, html .RadGrid td.rgBatchCurrent .rfdCheckboxChecked, html .RadGrid td.rgBatchCurrent .RadCheckBoxList { margin-left: 12px; } /* if no form decorator */ html .RadGrid td.rgBatchCurrent input[type='checkbox'] { width: auto; margin-left: 16px; } /* in case you have radio buttons even though they are not a supported editable control with batch editing*/ /* for form decorator */ html .RadGrid td.rgBatchCurrent .rfdRadioUnchecked, html .RadGrid td.rgBatchCurrent .rfdRadioChecked, html .RadGrid td.rgBatchCurrent .RadRadioButtonList{ margin-left: 12px; } /* if no form decorator */ html .RadGrid td.rgBatchCurrent input[type='radio'] { width: auto; margin-left: 16px; } </style>
If AJAX is enabled for the RadGrid and re-ordering its columns, a JavaScript exception is thrown: "uncaught typeerror: cannot set property 'control' of undefined"
Reproduction of the issue
RadGrid declaration
<telerik:RadButton runat="server" Text="PostBack" AutoPostBack="true"></telerik:RadButton>
<telerik:RadGrid runat="server" ID="RadGrid2">
<MasterTableView DataKeyNames="Column1" ClientDataKeyNames="Column1" CommandItemDisplay="Top">
<Columns>
<telerik:GridBoundColumn UniqueName="Col1" DataField="Column1" HeaderText="Col1"s></telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Col2" DataField="Column2" HeaderText="Col2"></telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Co13" DataField="Column3" HeaderText="Co13"></telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Col4" DataField="Column4" HeaderText="Col4"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings ReorderColumnsOnClient="false" AllowColumnsReorder="true">
<DataBinding Location="~/Api/RevCodeGrid" SelectMethod="GetDataAndCount2" >
</DataBinding>
</ClientSettings>
</telerik:RadGrid>
RevCodeGridController
public class Test
{
public String Column1 { get; set; }
public String Column2 { get; set; }
public String Column3 { get; set; }
public String Column4 { get; set; }
}
[HttpPost]
public virtual RadGridResultData GetDataAndCount2(object context)
{
List<Test> items = new List<Test>();
items.Add(new Test() { Column1 = "1", Column2 = "A", Column3 = "A1", Column4 = "A12" });
items.Add(new Test() { Column1 = "2", Column2 = "B", Column3 = "B1", Column4 = "B12" });
items.Add(new Test() { Column1 = "3", Column2 = "C", Column3 = "C1", Column4 = "C12" });
items.Add(new Test() { Column1 = "4", Column2 = "D", Column3 = "D1", Column4 = "D12" });
return new RadGridResultData { Data = items, Count = items.Count };
}
Using CommandItemTemplate (Grid - Command Item) for Editing DetailTable records and selecting an item after filtering or from another page, one item from the first page is put for editing instead. Open the attached GIF animation (EditSelectedEditWrongItem.gif) to see it in action.
Currently the workaround we offer is to handle the EditSelected command manually for all the DetailTables Except for the Master.
Grid markup:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Width="100%" PageSize="3"
OnItemCommand="RadGrid1_ItemCommand"
OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
OnNeedDataSource="RadGrid1_NeedDataSource">
<MasterTableView Name="MasterTable" AutoGenerateColumns="true" DataKeyNames="OrderID">
<DetailTables>
<telerik:GridTableView Name="ChildTable" DataKeyNames="OrderID" AutoGenerateColumns="true" CommandItemDisplay="Top">
<CommandItemTemplate>
<asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" CssClass="btn btn-default">Edit Selected</asp:LinkButton>
</CommandItemTemplate>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true" />
</ClientSettings>
</telerik:RadGrid>
C# - ItemCommand
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
// Logic applies for all the tables (detail tables) which are not named "MasterTable"
if(e.Item.OwnerTableView.Name != "MasterTable" && e.CommandName == RadGrid.EditSelectedCommandName)
{
e.Canceled = true;
GridTableView detailTable = e.Item.OwnerTableView;
if (detailTable.OwnerGrid.SelectedIndexes.Count == 0)
{
return;
}
foreach (GridDataItem selectedItem in detailTable.OwnerGrid.SelectedItems)
{
selectedItem.Edit = true;
}
detailTable.Rebind();
}
}
VB - ItemCommand
Protected Sub RadGrid1_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs)
If e.Item.OwnerTableView.Name <> "MasterTable" AndAlso e.CommandName = RadGrid.EditSelectedCommandName Then
e.Canceled = True
Dim detailTable As GridTableView = e.Item.OwnerTableView
If detailTable.OwnerGrid.SelectedIndexes.Count = 0 Then
Return
End If
For Each selectedItem As GridDataItem In detailTable.OwnerGrid.SelectedItems
selectedItem.Edit = True
Next
detailTable.Rebind()
End If
End Sub
https://www.screencast.com/t/4BCjMdLqQS5
To replicate the problem:
Clicking on the Edit button fires the RowClick event of the Grid instead of Edit/Save/Cancel.
The manually entered value of RadDateTimePicker is replaced with the original one in Batch Edid mode in iPad. To reproduce this incorrect behavior add a new <telerik:GridDateTimeColumn HeaderText="Start Date" UniqueName="StartDate" DataField="StartDate" DataFormatString="{0:MM/dd/yyyy}"> </telerik:GridDateTimeColumn> column in the Batch Edit demos of RadGrid and test under iPad. Tap over RadTextBox, enter some new date and press Go/tap out and you'll see the problem.
A workaround is to access the column and replace the text of the cell with a <label> control. Examples are attached below
When virtualization is enabled for RadGrid, NeedDataSource is called at every Post back with RebindReason = ExplicitRebind, regardless of the event target.
Steps to reproduce:
Use the following Code snippets for the runnable sample and debug the NeedDataSource event while doing post backs using other controls. For instance, you can use the RadButton1 from these snippets to make a standard Post Back.
If a column does not have width set, it will not populate the Columns collection of the ExportInfrastructure in the BiffExprorting event http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/functionality/exporting/export-formats/excel-biff-export To be able to loop through all columns, you need to have width specified for them. This change has been introduced in Q3 2014 If you cannot do this for the standard grid rendering when defining columns, you can use the Grid.PreRender event to loop all columns and set some width for them: VB Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender 'workaround for BiffExporting event Columns collection not being populated if the column does not have width set Dim Grid As RadGrid = DirectCast(sender, RadGrid) If (Grid.IsExporting) Then For index = 0 To Grid.MasterTableView.Columns.Count - 1 Grid.MasterTableView.Columns(index).HeaderStyle.Width = 100 Next End If End Sub C# protected void RadGrid1_PreRender(object sender, System.EventArgs e) { //workaround for BiffExporting event Columns collection not being populated if the column does not have width set RadGrid Grid = (RadGrid)sender; if ((Grid.IsExporting)) { for (index = 0; index <= Grid.MasterTableView.Columns.Count - 1; index++) { Grid.MasterTableView.Columns(index).HeaderStyle.Width = 100; } } }
The Filtering context menu is not positioned properly when there is not enough height. It is positioned depending on the top border of the window, making the filters not accessible. Screencast: https://www.screencast.com/t/4dQEAczF9c2 Steps to reproduce: 1. Open http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/filtering/excel-like-filtering/defaultcs.aspx 2. Resize the browser so the last elements of the Grid are not visible 3. Open the Filtering context menu Result: It is shown with too big negative top margin