Workaround: Using the Page_Load event handler, verify which control has initiated the postback as well check whether the Event argument is PageSize. protected void Page_Load(object sender, EventArgs e) { if (IsPostBack && Request.Params["__EVENTTARGET"].StartsWith(RadGrid1.UniqueID)) { // check whether the command was PageSizeChange if (Request.Params["__EVENTARGUMENT"].Contains("PageSize;")) { string[] details = Request.Params["__EVENTARGUMENT"].Split(';'); GridTableView tableView = FindControl(details[0].Replace("FireCommand:", "")) as GridTableView; int newPageSize = int.Parse(details[2]); Label1.Text += "TableView Name: " + tableView.Name + ", NewPageSize: " + newPageSize+"<br />"; } } }
Enable filtering, Enable HeaderContextMenu and HeaderContextMenuFilter. First, filter using the HeaderContextMenu filter (e.g. OrderDate GreaterThanOrEqualTo "someDate" AND OrderDate LessThanOrEqualTo "someOtherDate" Second, apply a filter on another column using the Header filter only (e.g. Freight GreaterThanOrEqualTo "4") At this point, the filtering applied by the HeaderContexFilterMenu is now partially removed. Issue only appears when Header filter and HeaderContextMenu filter are used in combination. They work as expected when used separately.
How is it possible to autofit / autosize a giving column (or all columns) when exporting the contents from RadGrid to xlsx using ExportStructure? The only option available is Width with a defined value. I was unable to find an autofit / autosize function. And also add AutoFilter feature... Please consider to add this features :-)
There are two possible approaches to overcome this issue: - First approach would be to get a reference to the GridHTMLEditorColumn and add the desired tools in the code behind using the "OnItemCreated" server event handler of RadGrid. - Second approach would be to use GridTemplateColumn with RadEditor.
I have a RadGrid with around 150 columns and a few hundred rows. Currently, I'm looping over them and setting their widths with the resizeColumn function. Unfortunately, it's triggering a recalculation of the layout every time I call this function, so the total page load time can be in the minutes. Oddly, much of the time was spent on the line: e.style.width=e.offsetWidth-d+"px"; Chrome's developer tools helpfully pointed me at Forced Reflow. Apparently, when a width is set, initially no extra work is done. When another width is requested, the previous width may have changed it, so the whole layout gets recalculated. The feature I'd like to request is a function to set column widths in bulk (accepting anything like an array or a dictionary would be fine) that doesn't trigger this recalculation mid-function.
The date pickers default to the year 1999 and do not accept inputs, so you cannot filter GridDateTimeColumn instances through the header context menu or the excel-like filtering. The standard filter item and range filter can still be used instead of context menus, but they are not available with excel-like filtering.
At the moment, RTL support for excel like filtering is not implemented. It displays the following issues - menu position is wrong (tends to show up on the column to the left) - controls alignment inside the menu is wrong (ltr) You can find attached a sample and screenshots with the current behavior
The reason for the behavior is that the column editor does not move to the cell when you cancel its opening. Opening a cell in the same column expects the column editor to be in the previously opened cell, however, and this causes the error. Repro is attached to illustrate the scenario. Workarounds: - Use EditType=Cell so that each cell opens independently of the row (wokaround 1). - Use the provided function override (workaround 2). Make sure to remove it after upgrading to a release that has the fix. This function override may prevent you from getting other updates and fixes in this function. - Use a template column and hide the editor based on your condition in the OnBatchEditOpened event (workaround 3)
If there are hidden columns before the ColumnGroups while exporting to excel (format Xlsx), header text of columngroups are shifted to the left. - Workaround, is to move the hidden column after the ColumnGroups.
In some cases, inside the Grid table, the tfoot element is rendered before the tbody element. This causes some readers to read the footer before the body.
A possible workaround is moving the tfoot after the tbody in the OnGridCreated event:
<script>
function OnGridCreated(sender, args) {
var $ = $telerik.$;
$('tfoot').each(function (index, item) {
var $item = $(item);
var $next = $item.next();
if ($next[0]) {
if ($next[0].tagName.toLowerCase() == "tbody") {
$item.insertAfter($next);
}
}
});
}
</script>
A forum discussion on the topic:
I think it would be a great addition to the grid control if there was an attribute that you could apply to the columns called "SortNullsLast" or something along those lines. This attribute would modify the grid's sorting functionality and only apply the ascending or descending sort to non-null values. Currently when you sort ascending, null values are sorted to the top of the grid. This new attribute would allow the non-null values to show up at the top in ascending order. An example of why this would be useful is having a grid that tracks an optional requested completion date of a task. You would want to be able to sort the grid so that the earliest date shows first in the grid. Right now, any records that don't have this optional date would show first, which doesn't make sense.
It seems the element somehow considmes the scrolling/touch action and the grid does not scroll unless you hit the gap where the custom element does not reach. A workaround is to enforce overflow: auto to the scrollable element of the grid. A sample is attached below. div.rgDataDiv { overflow: auto !important; }
Provide a simple interface to showcase exactly in what order the columns have been sorted in (ex. 1, 2, 3, etc in column header) - matching the functionality in Kendo UI Grid: http://demos.telerik.com/kendo-ui/grid/sorting
I would like to suggest that the Buttons in the RadGrid allow databinding to the CommandName and CommandArgument fields. And pretty much all the buttons or anything that triggers an ItemCommand event that allow a CommandName and CommandArgument have their properties to be databound and accessible in the code behind. Thanks!!!
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
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; } } }
For Bug Report : Note: We are using MM/dd/yyyy as Internal Date format to prevent issue while inserting or updating value. Steps to reproduce: When we use dd-MM-yyyy and yyyy-dd-MM Date DisplayFformat for RadDatePicker/RadDateTimePicker control as well as view mode in Radgrid Batch Edit mode it's render behaviour is inconsistent 1. When dd is less than or equal to 12 then while rendering in edit mode Month and Date is interchanged 2. When dd is greather than 12 then while rendering in edit mode Month and Date is rendered correctly.
A valid SQL statement should look like SELECT * FROM Products WHERE ([Discontinued] = 1) or SELECT * FROM Products WHERE ([Discontinued] = 'True') but RadGrid provides something like ([Discontinued] = True) in the MasterTableView.FilterExpression property. By default RadGrid filters the data on its own after retrieving the entire data set form the data source, and the filtering operation works like that. If you will be using the filter expression provided by the grid in a custom data source operation you may need to tweak the string first. Note that changing this may result in a breaking change if you are already using the current syntax. Workaround: https://www.telerik.com/support/kb/aspnet-ajax/grid/details/get-sql-compliant-filterexpressions-from-radgrid
You would get something like (([createddate] >= '01/08/2017,00:00:00') AND ([createddate] <= '14/08/2017,23:59:59')) while you should get something like (([createddate] >= '01/08/2017 00:00:00') AND ([createddate] <= '14/08/2017 23:59:59')) so that the SQL syntax is valid. RadGrid, does not send the FilterExpression to the SqlDataSource, however. It executes the SELECT statement and then filters the resulting data on its own. This works fine. If you will be performing operations yourself, you could use a string operation before passing the filter expression. For example: protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { if (!string.IsNullOrEmpty(this.RadGrid1.MasterTableView.FilterExpression)) { if (this.RadGrid1.MasterTableView.FilterExpression.Contains("createddate")) { this.RadGrid1.MasterTableView.FilterExpression = this.RadGrid1.MasterTableView.FilterExpression.Replace(",", " "); } DataView dv =GetData("select * from [myTable] where ", this.RadGrid1.MasterTableView.FilterExpression); //where you would need to have something like (([createddate] >= '01/08/2017 00:00:00') AND ([createddate] <= '14/08/2017 23:59:59')) this.RadGrid1.DataSource = dv; } } Note that implementing such a change may break existing code that relies on the current syntax that contains the comma.