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();
}
Hello,
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-indicatorshttp://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.
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
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
I have EnableDataViewState="true" and also sorting under the grid but my sort does not seems to work at all ... my data is like a small set of 3-4 records lke below
abc_cdf_150
abc_cdf_152
abc_cdf_101
so i expect it to be in the order of 101 , 151 , 152 asec order & 152 , 151 , 101 in desc order . this does not seem to work , can you suggest what am i missing here ?
Please notice, when behaviors are used (Sorting, Filtering, etc.) and EnableDataViewState="true", then WebDataGrid should be rebound on behavior events.
I have created a code sample in order to better illustrate the approach. I have added two WebDataGrids. The first is using EnableDataViewState="true" and the DataSource is Bound on the server side ColumnSorted event.
The second one illustrates a non working Sorting scenario, as there is no Data Binding in the required event.
I am initially binding the grids to data source when the page is loaded for first time, as per your requirements. What is more, I have tweaked a code sample I have previously used in a forum thread related to integer type column sorting. I believe you may be interested in it http://ko.infragistics.com/community/forums/t/83579.aspx
The sorting you could expect from the data you are using is a string like sorting. For example, the values will not be sorted based on the numbers at the end but like:
abc_cdf_1abc_cdf_10abc_cdf_11….
abc_cdf_19abc_cdf_2abc_cdf_20abc_cdf_21etc.
Please refer to the attachment for details!
Online documentations and additional resources: http://help.infragistics.com/Help/Doc/ASPNET/2014.1/CLR4.0/html/WebDataGrid_Getting_Started_with_WebDataGrid_EnableDataViewState_Property.html
http://help.infragistics.com/doc/ASPNET/2014.1/CLR4.0/?page=WebDataGrid_Sorting.html
I am upgrading from webcombo to Webdropdown control and need the following code to be replaced with it corresponding webdropdown.
1) this.webcombo1.DisplayValue --> equivalent in webdropdown ?
2)webcombo1.Rows.Clear(true); --> equivalent in webdropdown ?
3)this.webcombo1.DataSource -->equivalent in webdropdown ?
4) this.webcombo1.SelectedIndex = 0; --->equivalent in webdropdown ?
5) foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow dr in this.webcombo1.Rows) ---> equivalent in webdropdown ?
I need to replace the above with there webdropdown equivalent
Since this thread is regarding a different issue, and there is already an existing forum thread for the WebCombo equivalents, I suggest referring to:
http://ko.infragistics.com/community/forums/p/91541/452596.aspx#452596