Welcome Guest Search | Active Topics | Sign In | Register

Reset EO.Grid Options
Raghav Nayak
Posted: Tuesday, June 16, 2009 6:05:56 AM
Rank: Advanced Member
Groups: Member

Joined: 8/21/2008
Posts: 37
Hi,

Whenever we select the value from the dropdown, based on that value the data will be binded to the EO.Grid. Say even though there won't be any record in the EO.Grid,
it will show the page nos of earlier binded data. How to reset the paging no?

Thanks & Regards,
Raghav

Code: C#
protected void ddlDocumentType_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        Grid1.CurrentPage = 0;
        
        if (ddlDocumentType.SelectedIndex != 0)
            LoadGridData(null);        
    }

eo_support
Posted: Tuesday, June 16, 2009 9:31:27 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You would need to call LoadGridData regardless. LoadGridData always clear the data first, then populate from your data source.

Thanks!
Raghav Nayak
Posted: Wednesday, June 17, 2009 5:59:41 AM
Rank: Advanced Member
Groups: Member

Joined: 8/21/2008
Posts: 37
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();
        }
    }
eo_support
Posted: Wednesday, June 17, 2009 9:07:57 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We are not able to reproduce the problem here. You may want to update to the latest version first, if the problem continues, please try to isolate the problem into a separate test project and send the project to us. We will PM you as to where to send.

Make sure your test project runs independently. We will need to run it to see the problem. Since the issue is related to paging, I do not think it has anything to do with your data source. So you can simply feed the Grid an empty array to generates all the rows in your test project. For example, the following code creates 100 rows:

Code: C#
Grid1.DataSource = new object[100];
Grid1.DataBind();


Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.