<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"true"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
>
<
ExportSettings
ExportOnlyData
=
"true"
>
<
Excel
Format
=
"Biff"
/>
</
ExportSettings
>
<
MasterTableView
Caption
=
"My Personalized caption"
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
ShowExportToExcelButton
=
"true"
/>
</
MasterTableView
>
</
telerik:RadGrid
>
protected
void
RadGrid1_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource = OrdersTable();
}
private
DataTable OrdersTable()
{
DataTable dt =
new
DataTable();
dt.Columns.Add(
new
DataColumn(
"OrderID"
,
typeof
(
int
)));
dt.Columns.Add(
new
DataColumn(
"OrderDate"
,
typeof
(DateTime)));
dt.Columns.Add(
new
DataColumn(
"Freight"
,
typeof
(
decimal
)));
dt.Columns.Add(
new
DataColumn(
"ShipName"
,
typeof
(
string
)));
dt.Columns.Add(
new
DataColumn(
"ShipCountry"
,
typeof
(
string
)));
dt.PrimaryKey =
new
DataColumn[] { dt.Columns[
"OrderID"
] };
return
dt;
}
System.ArgumentOutOfRangeException
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
This error seems to happen if there is a GridTemplateColumn that has the Exportable property set to False.
Hi
Since updating to the latest release of UI for ASP.NET AJAY the RadContextMenu of my RadGrid is misaligned at the right edge of the screen. Even in your sample https://demos.telerik.com/aspnet-ajax/grid/examples/columns-rows/columns/context-menu/defaultcs.aspx when you open the context menu at the right side of the screen the context menu is nor aligned to the left (like it used to be).
Please ses the attached printscreen.
Kind regards
Felix
Would be great if font awesome could be used for the radgrid edit/delete/ icons etc....
Currently when doing a Batch Edit with the Grid each row and cell must be updated with a new/edited value before saving. Example: a User has a Grid containing records and would like to update several records because a Date field requires updating. Can it be possible for the User to select the Rows they would like to update, Edit the Date Field(using the example above), but this time when Saved all records that were selected are updated. This solution may require a modal to be displayed that shows all fields available, similar to Edit/Insert grid Popup. The appropriate field is then updated and saved only to selected records. This feature would save a lot of time by not having to edit each row individually then saving.
When Scrolling is enabled with Frozen columns in RadGrid, horizontal scrollbar not visible in Microsoft Edge. Issue appears in Microsoft Edge Version: - Microsoft Edge 42.17134.1.0 - Microsoft EdgeHTML 17.17134 WORKAROUND: Apparently, setting the horizontal scrollbar's height to 17 pixels will make Microsoft Edge display it. (Note: in case it still not displaying, you may try with 18px) To set the height, you can choose one of the options below: 1. Using CSS style to increase the size of the horizontal scrollbar by one pixel. <style type="text/css"> .RadGrid div[id$="_Frozen"] { height: 18px; /* or */ /*padding-bottom: 1px;*/ } </style> 2. Using JavaScript Subscribe the grid to its GridCreated client-side event, and in the event handler increase the element's height with the scrollbar then revert it back to its original size with a delay: <script type="text/javascript"> function GridCreated(sender, args) { $('div[id$="_Frozen"]').height(17); } </script>
Hidden columns are shown on resize when the static headers and frozen column are used. Video: https://www.screencast.com/t/4Lwuvbp7 Possible workarounds: - Hide the column with Visible="False", instead of Display="False" - Hide the column on the client-side: function gridCreated(sender, args) { var masterTableView = sender.get_masterTableView(); columnIndex = masterTableView.getColumnByUniqueName("ShipName").get_element().cellIndex; setTimeout(function () { masterTableView.hideColumn(columnIndex); }, 2); } Steps to reproduse: <telerik:RadGrid RenderMode="Lightweight" HeaderStyle-Width="200px" AutoGenerateColumns="false" ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource" Width="100%" runat="server"> <ClientSettings> <Scrolling AllowScroll="True" UseStaticHeaders="true" FrozenColumnsCount="2"></Scrolling> </ClientSettings> <MasterTableView AutoGenerateColumns="false"> <Columns> <telerik:GridBoundColumn DataField="SongID" HeaderText="SongID" FilterControlWidth="50px" HeaderStyle-Width="50px"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="SongTitle" HeaderText="Song Title" FilterControlWidth="200px"></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CollectionName" HeaderText="Collection Name" FilterControlWidth="200px"></telerik:GridBoundColumn> <telerik:GridBoundColumn FilterControlWidth="50px" DataField="VersionID" HeaderText="VersionID" Display="false"></telerik:GridBoundColumn> </Columns> </MasterTableView> </telerik:RadGrid> Code Behind: protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { (sender as RadGrid).DataSource = GetData(); } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("SongID"); dt.Columns.Add("SongTitle"); dt.Columns.Add("CollectionName"); dt.Columns.Add("VersionID"); for (int i = 0; i < 20; i++) { dt.Rows.Add(i, i + 1, i + 2, i + 3); } return dt; }
As a temporary workaround you can use Template column with a DataField set.
Such an exposed method, which returns the value from the ExportOutput, would be useful to further enhance the exporting capabilities of the RadGrid control. A very practical example would be to export numerous RadGrid controls into one Excel file.
It becomes hard to see the checked checkboxes because of the selected color it has by default matches the select color of the grid Solution: .RadGrid_BlackMetroTouch .rgSelectedRow .RadCheckBox.RadButton_BlackMetroTouch .rbToggleCheckboxChecked::before, .RadGrid_Bootstrap .rgSelectedRow .RadCheckBox.RadButton_Bootstrap .rbToggleCheckboxChecked::before, .RadGrid_Metro .rgSelectedRow .RadCheckBox.RadButton_Metro .rbToggleCheckboxChecked::before, .RadGrid_MetroTouch .rgSelectedRow .RadCheckBox.RadButton_MetroTouch .rbToggleCheckboxChecked::before { color: white; } .RadGrid_Glow .rgSelectedRow .RadCheckBox.RadButton_Glow .rbToggleCheckboxChecked::before, .RadGrid_Office2010Black .rgSelectedRow .RadCheckBox.RadButton_Office2010Black .rbToggleCheckboxChecked::before, .RadGrid_Telerik .rgSelectedRow .RadCheckBox.RadButton_Telerik .rbToggleCheckboxChecked::before, .RadGrid_WebBlue .rgSelectedRow .RadCheckBox.RadButton_WebBlue .rbToggleCheckboxChecked::before { color: black; } Sample to reproduce the behavior and compare the default colors in other states/cases: <telerik:RadCheckBox runat="server" ID="rcb1"></telerik:RadCheckBox> <br /> <telerik:RadCheckBox runat="server" ID="rcb2" Checked="true"></telerik:RadCheckBox> <telerik:RadSkinManager runat="server" ID="RadSkinManager1" Skin="Bootstrap" ShowChooser="true"> </telerik:RadSkinManager> <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" RenderMode="Lightweight" /> <asp:CheckBox ID="Checkbox1" Text="some checkbox" runat="server" /> <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" RenderMode="Lightweight"> <MasterTableView> <Columns> <telerik:GridClientSelectColumn></telerik:GridClientSelectColumn> <telerik:GridTemplateColumn HeaderText="rad check box column"> <ItemTemplate> <telerik:RadCheckBox runat="server" ID="RadCheckBox1"></telerik:RadCheckBox> <br /> <telerik:RadCheckBox runat="server" ID="RadCheckBox2" Checked="true"></telerik:RadCheckBox> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings> <Selecting AllowRowSelect="true" /> </ClientSettings> </telerik:RadGrid> And a dummy data source that is not a good data source in general, but it will suffice to get this running so one can observe protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { (sender as RadGrid).DataSource = "abcdef"; }
Due to browser restrictions, the print behavior is changed and works identically to the one of IE - a new tab/dialog with the grid is opened whose print command is launched. You can observe the behavior in IE at https://demos.telerik.com/aspnet-ajax/grid/examples/functionality/printing/defaultcs.aspx.
Workaround: https://www.telerik.com/support/kb/aspnet-ajax/grid/details/clientdatasource-binding-and-batch-editing-page-is-reset-to-1-after-deleting-a-record A fix in the codebase of the grid will take time, effort and will have to wait in the queue, which is why this is the official solution.
Repro steps: - go to the RadClientDataSource binding demo: https://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/client-data-source-binding/defaultcs.aspx - filter a column so there is no data in the grid - remove the filter Actual: the pager is gone Expected: the pager is there SOLUTION: see the following KB article: https://www.telerik.com/support/kb/aspnet-ajax/grid/details/clientdatasource-binding-after-filtering-so-no-records-are-present-and-removing-the-filter-there-is-no-pager You can show the pager when the filter command is executed: function OnCommand(sender, args) { if (args.get_commandName() == "Filter") { $telerik.$(sender.get_element()).find(".rgPager").show(); } } A fix in the codebase of the grid will take time, effort and will have to wait in the queue, which is why this is the official solution.
RadGrid GridDateTimeColumnEditor is unable to process data of type TimeSpan if PickerType is set to TimePicker. As a workaround, a GridTemplateColumn can be used with a TimePicker inside EditTemplate <telerik:GridTemplateColumn> <ItemTemplate> <%# Eval("Field") %> </ItemTemplate> <EditItemTemplate> <telerik:RadTimePicker ID="RadTimePicker1" runat="server" SelectedTime='<%# Bind("Field") %>'></telerik:RadTimePicker> </EditItemTemplate> </telerik:GridTemplateColumn>
We have a RadGrid, which has a set of columns, lets say C1 to CN. Some of those columns are invisible and can be made visible with the Columns context menu, your control provides. Assume a column Ci, that is not visible now. If there exists a visible column Cx with x > i, your control works as expected. The column spans of the headline are ok. See GoodCase_Step.jpg If there is no visible column Cx with x > i and Ci is switched visible, your column spans within the headline become completely invalid. See BadCase.jpg_Step.jpg We use Version 2017.3.913.45 of your library. Thanks for your Support!