I can't get built in behaviors to work when binding to my custom collection, it works perfectly when using a SQLDataSource. Is there something my custom collection needs to implement to get this functionality working correctly?? I've tried Dictionary, BindingList, and List, none of which have worked... Code is below:
ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication4.WebForm1" %>
<%@ Register Assembly="Infragistics4.Web.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="100%">
<Behaviors>
<ig:ColumnMoving DragMarkupCssClass="">
</ig:ColumnMoving>
<ig:ColumnResizing>
</ig:ColumnResizing>
<ig:Filtering>
</ig:Filtering>
<ig:Paging PageSize="10">
</ig:Paging>
<ig:RowSelectors>
</ig:RowSelectors>
<ig:Selection CellClickAction="Row" CellSelectType="None"
RowSelectType="Single">
</ig:Selection>
<ig:Sorting>
</ig:Sorting>
</Behaviors>
</ig:WebDataGrid>
</div>
</form>
</body>
</html>
Hello,
The grid is built with idea in mind to be as much as possible lightweight component. It implements this as use AJAX Technology to make AJAX Callbacks to the server whenever data are needed. So , almost all behaviors : Sorting Filtering, Paging require datasource to be provided on each AJAX Callback (DataBind is not needed to be invoked) on page load the grid take care for this.
If you want to bind the grid only once you could enable EnableDataViewState, more info on this matter :
http://help.infragistics.com/NetAdvantage/ASPNET/2010.2?page=WebDataGrid_Getting_Started_with_WebDataGrid_EnableDataViewState_Property.html
Hope this helps
I got it working, I removed the IsPostBack condition in the code-behind so i load and bind the data everytime it posts back, that allows the sorting, paging, and filtering to work correctly.
However, this brings up another question/concern... is there any recommended way to cache the data so that I am not querying the database every time it posts back??