Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
550
Sorting on grid
posted
Currently i am binding my datasource on  page_load (!this.IsPostBack) alone  but sorting seems to only work when i bind the grid each time even on post back ? Is there an alternative  to enable sorting  when i dont bind my  grid on post back ?

 <igtbl:Sorting Enabled="True" SortingMode="Single" >
</igtbl:Sorting>


protected void Page_Load(object sender, EventArgs e)
{

if (!this.IsPostBack)
{

 grid.DataSource = dataTable;
 grid.DataBind();
}
}
Parents
No Data
Reply
  • 10685
    Suggested Answer
    Offline posted

     Hello,

    1. In general, in WebDataGrid all operations (sorting, filtering, paging and so on) are done via an Ajax callback to the server. Due to this make sure that on each postback you set the data source for the grid so that the grid will be able to apply the related database operation (sort, filter or page the data source). 

    Our online samples are a solid base for familiarizing with the new architecture and available functionality, interaction, visualization etc. For reference:
    http://ko.infragistics.com/samples/aspnet/data-grid/sorting-custom-indicators
    http://ko.infragistics.com/samples/aspnet/data-grid/sorting-with-unbound-column 

    You either have to give the grid its DataSource on every postback or you need to turn on EnableDataViewState so that the grid stores its records in its view state.  Those are the only options.  If the grid source is not supplied, it will show up empty. 

    1. EnableDataViewState="true" – most used for not too large Data Sources. When behaviors are used (WebDataGrid) should be rebound on behavior events. DataViewState is in effect only when the grid is bound for the DataSource Property (using the ID) and is not PostBack.

    Detailed description illustrating the several possible scenarios, could be found at: OnlineDocumentation 

    1. It is also possible to use session to persist the changes made to the original DataSource (if this DataSource is only initially set on let’s say Page Load). ASP.NET session state enables you to store and retrieve values for a user as the user navigates ASP.NET pages in a Web application. HTTP is a stateless protocol. This means that a Web server treats each HTTP request for a page as an independent request. The server retains no knowledge of variable values that were used during previous requests. ASP.NET session state identifies requests from the same browser during a limited time window as a session, and provides a way to persist variable values for the duration of that session. By default, ASP.NET session state is enabled for all ASP.NET applications. 

    If interested, you could find a quick explanation of “Efficient use of EnableAjax, EnableAjaxViewState, EnableDataViewState and EnableViewState” here:
    http://ko.infragistics.com/community/forums/t/65461.aspx

Children