When a big number of items are bound to RadGrid on the server side and Virtualization is enabled paging to the last item is not working as expected.
The problem can be reproduced with the setup in the following demo:
Increasing the number of Customers bound to the Grid to more than 1000000 leads to the problem.
ResizeGridOnColumnResize is not working the same way when Grid has StaticHeaders.
I want to resize the grid based on the contents and still be able to scroll with headers.
Upon inserting a new record after filtering on the Grid with No records, the exception "No property or field 'Name' exists in type 'DataRowView'" is thrown.
Steps to reproduce:
Code to replicate the issue:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="true"
OnNeedDataSource="RadGrid1_NeedDataSource" OnInsertCommand="RadGrid1_InsertCommand">
<MasterTableView CommandItemDisplay="Top" DataKeyNames="ID">
<Columns>
<telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
<telerik:GridButtonColumn CommandName="Delete"></telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID" ReadOnly="true"
CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" />
<telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name"
AutoPostBackOnFilter="false" />
<telerik:GridBoundColumn DataField="Category" HeaderText="Category" UniqueName="Category" DataType="System.String"
CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" />
<telerik:GridBoundColumn DataField="Price" HeaderText="Price" UniqueName="Price"
CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" DataFormatString="{0:C}" />
</Columns>
<EditFormSettings InsertCaption="Add New Item" />
</MasterTableView>
</telerik:RadGrid>
C#
private const string DataTableSessionKey = "RadGridDataTable";
private DataTable SessionDataSource
{
get
{
DataTable dt = Session[DataTableSessionKey] as DataTable;
if (dt == null || !IsPostBack)
{
// Create an empty DataTable with schema defined
dt = new DataTable();
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Category", typeof(string));
dt.Columns.Add("Price", typeof(decimal));
dt.PrimaryKey = new DataColumn[] { dt.Columns["ID"] };
Session[DataTableSessionKey] = dt;
}
return dt;
}
}
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
(sender as RadGrid).DataSource = SessionDataSource;
}
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
{
GridEditableItem insertItem = (GridEditableItem) e.Item;
Hashtable newValues = new Hashtable();
insertItem.ExtractValues(newValues);
DataRow findLastItem = SessionDataSource.Select("ID=MAX(ID)").FirstOrDefault();
newValues["ID"] = findLastItem != null ? (int) findLastItem["ID"] + 1 : 0;
DataRow rowToInsert = SessionDataSource.NewRow();
foreach (DictionaryEntry entry in newValues)
{
rowToInsert[entry.Key.ToString()] = entry.Value ?? DBNull.Value;
}
SessionDataSource.Rows.Add(rowToInsert);
}
Additional improvements for the MultiColumn Headers can be considered if needed: 1. Support for Header context menu 2. Client-side show / hide operations with the columns
When Grouping on an Integer value, the groups are not ordering correctly. i.e. if you group on values {864, 1455, 1494}, the actual order comes out as {1455, 1494, 864}. Ordering on the same data, but converted to a string and padded to the left with zeros resolves this issue.
Hi, In our project we are using the telerik grid on Invoice screen to display item list. We are adding item from text box and adds it to grid dynamically using UpdateGrid javascript function. Issue: When we add the new item to grid. It adds to grid as last row. But grid is not scrolling to last row. We want to scroll grid to last row every time we add new item. Below are the settings used in grid which did not work out: <ClientEvents OnRowSelected="rowSelected" OnRowCreated="OnRowCreated" OnRowCreating="OnRowCreating" /> <Scrolling AllowScroll="True" EnableVirtualScrollPaging="True" UseStaticHeaders="false" SaveScrollPosition="true" /> Please help.
I'm a great fan of KendoUI and love the declarative binding and property declaration with JavaScript Literal notation. However, Rest Binding in SharePoint is still immature and there is very little support for relationships and data projections. As a result, I find myself coming back to the SPRadGrid. However, I find the functionality very limited and in some cases non-functional. I'd love to see a rewrite of the SPRadGrid that has more functions and used declarative bindings. I'd also like to see solution package distributed with a working Grid sample so that it was easier to modify it and deploy a customized solution. SharePoint is complex. It's always easier to start with a working sample.