Hi,
The LoadGridData is clearing the data except the page nos.
I'm selecting a dropdown value. When a value is selected, based on that the data will be binded to the EO.Grid.
Ex: Say my pagesize = 5. If I select a value in a dropdown, and it will return 50 records.
Then page nos will be 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 for the EO.Grid.
Now i'll select different value in the dropdown, then say it returned 3 records. Then my EO.Grid paging should show me page no = 1 only. But its showing all the old values 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. I hope you got my point. Please see my code below.
Regards,
Raghav
Code: C#
protected void ddlDocumentType_SelectedIndexChanged(object sender, System.EventArgs e)
{
Grid1.CurrentPage = 0;
if (ddlDocumentType.SelectedIndex != 0)
LoadGridData(null);
}
private void LoadGridData(EO.Web.GridColumn sortColumn)
{
try
{
//carerOtherController.BeginRequest();
string sortField;
string sortOrder;
if (sortColumn == null)
sortColumn = Grid1.SortColumn;
if (sortColumn != null)
{
sortField = sortColumn.DataField;
sortOrder = sortColumn.SortOrder == EO.Web.SortOrder.Ascending ? "ASC" : "DESC";
}
else
{
sortField = "ID";
sortOrder = "DESC";
}
if (sortField == "ID")
sortField = "ID";
string sortOrderReverse = sortOrder == "ASC" ? "DESC" : "ASC";
//Number of records to display in the current page
int recordsForCurrentPage = Grid1.PageSize;
//Number of records included by the current page and all pages before the current page
int recordsTillCurrentPage = (Grid1.CurrentPage + 1) * Grid1.PageSize;
//The current page may be the last page, in which case the total number of available records may be less than PageSize
if (recordsTillCurrentPage > Grid1.RecordCount)
{
recordsForCurrentPage -= recordsTillCurrentPage - Grid1.RecordCount;
recordsTillCurrentPage = Grid1.RecordCount;
}
ArrayList carerList = carerOtherController.RetrieveScannedDocumentsList (recordsTillCurrentPage, recordsForCurrentPage, carerData.ID, int.Parse(ddlDocumentType.SelectedValue));
if (carerList != null)
{
Grid1.DataSource = carerList;
Grid1.DataBind();
}
else
{
Grid1.Items.Clear();
}
carerList = null;
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
finally
{
//carerOtherController.EndRequest();
}
}