I am using UltraWebGrid v8.1. I am using custom sorting and custom paging. So in UltraWebGrid1_DataBinding event, I am setting UltraWebGrid1.DisplayLayout.Pager.PageCount and UltraWebGrid1.DataSource properties. I also disabled default sorting, as I am getting sorted records from SQL Server. My issue is even if I disabled default sorting, Grid still tries to sort records which I don't want. I have created a similar small sample code:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) {
UltraWebGrid1.DataBind();
}
}
protected void UltraWebGrid1_DataBinding(object sender, EventArgs e) {
//GetNumberOfPages() function returns total number of pages
UltraWebGrid1.DisplayLayout.Pager.PageCount = GetNumberOfPages();
//GetRecordsForPage() function returns for the given page. It returns sorted records.
DataTable dt = GetRecordsForPage(UltraWebGrid1.DisplayLayout.Pager.CurrentPageIndex);
UltraWebGrid1.DataSource = dt;
}
protected void UltraWebGrid1_InitializeLayout(object sender, LayoutEventArgs e) {
UltraWebGrid1.DisplayLayout.EnableInternalRowsManagement = false;
}
protected void UltraWebGrid1_SortColumn(object sender, SortColumnEventArgs e) {
e.Cancel = true;
UltraWebGrid1.DataBind();
}
protected void UltraWebGrid1_PageIndexChanged(object sender, PageEventArgs e) {
UltraWebGrid1.DisplayLayout.Pager.CurrentPageIndex = e.NewPageIndex;
UltraWebGrid1.DataBind();
}
}
I cannot find what I am doing wrong. I am using e.Cancel = true and UltraWebGrid1.DisplayLayout.EnableInternalRowsManagement = false. Can somebody help me. Thank you.