The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Trouble selecting a row when using paging.

Last post 12-18-2007, 8:51 AM by bbassler. 4 replies.
Sort Posts: Previous Next
  •  07-27-2007, 1:55 PM 4143

    Trouble selecting a row when using paging.

    Hello,

    I am using version 2007.0.528.0.  When I am using AutoPaging and select a row my page count goes back to 1.  I have tried to follow your beta documents closely for this initial test.

    I am setting the total rows on the esDataSource control if it is not a postback.

    Code:
    VwSeatPlan plan = new VwSeatPlan();
    plan.Query.es.CountAll = true;
    plan.Query.es.CountAllAlias = "SeatCount";
    if (plan.Query.Load())
    {
    	EsDataSource1.TotalRowCount = (int)plan.GetColumn("SeatCount");				
    }		

     

    and I am letting the esDataSource call the load function...

    Code:
    protected void EsDataSource1_esSelect1(object sender, esDataSourceSelectEventArgs e)
    {
    	VwSeatPlanCollection collection = new VwSeatPlanCollection();
    	e.Collection = collection;
    }

     

    I have AutoPaging and AutoSorting turned on.  I have the gridview sorting on a field via the gridview's sort method.  With these conditions anytime I select a row the page count goes back to 1.  What am I missing?

    Thanks,

    Peter

  •  07-28-2007, 6:51 AM 4149 in reply to 4143

    Re: Trouble selecting a row when using paging.

    I don't see anything immediately wrong with the snippets you posted, can you compare against this code. If you don't see anything different you will need to post more of your code for us to see what is going on.

    Regards,

    Scott Schecter
    EntitySpaces | My Site
  •  12-18-2007, 7:32 AM 7248 in reply to 4149

    Re: Trouble selecting a row when using paging.

    I'm trying to determine ES 2007.0.0913.0 esDataSource supports maintaining a selected grid row while paging. The info that I've found on this indicates the answer is 'Yes'. I'm just trying to verify this assumption and that I will not run into any gotchas. Plus, if I'm using ES in "StoredProc mode" and SQL Server 2005 I assume that will need to implement (return) ROW_NUMBER a la http://blog.scottschecter.net/2007/04/28/TheImprovedEntitySpacesEsDataSourceForASPNET.aspx
    Bill Bassler
  •  12-18-2007, 7:52 AM 7249 in reply to 7248

    Re: Trouble selecting a row when using paging.

    I'm not exactly sure what your asking? You would ordinarily trap the GridView's SelectedIndexChanged event like so to get the selected row.
    Code:
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 
    { 
    	if (EsDataSource2.State.ContainsKey("employeeid")) 
    		EsDataSource2.State["employeeid"] = GridView1.SelectedValue; 
    	else 
    		EsDataSource2.State.Add("employeeid", GridView1.SelectedValue); 
    		
    	FormView1.DataBind(); 
    	FormView1.ChangeMode(FormViewMode.Edit); 
    }
    As you can see we do offer a State property to track any keys you want to pass around and of course you could also use the query string. See our GridView/FormView sample code here for more. You would have to handle paging your own with sprocs, and that would kinda defeat the purpose of using the esDataSource in my mind. Also, please start a new thread for a new question like this instead of piggybacking.

    Regards,

    Scott Schecter
    EntitySpaces | My Site
  •  12-18-2007, 8:51 AM 7250 in reply to 7249

    Re: Trouble selecting a row when using paging.

    Thanks.

    You've verified what I was asking. I just wanted to know if: the esDataSource supported paging, persisting row selections across pages without any issues/mostly declaratively/little code. I found the code you've referenced and the esDataSource State looked like what is needed.  But I also saw this post implying a possible issue so I wanted to be sure.

    The issue with the GridView (even more so than the DataGrid) and paging, row selection etc is a sticky issue when not using MS ObjectDataSource binding (which I don't wish to use for various reasons); which persists the info necessary to implementation to allow for persisting selected rows across pages for example. So if you're not willing to go down the ObjectDataSource path you have few choices/have to implement all the various grid functions in sometimes very clunky ways.


    Bill Bassler
View as RSS news feed in XML