Hi there,
I'm attempting to implement the new paging in the csla framework.
My web form has several Text Boxes the user can enter criteria in to filter thier results. Then they submit the form and a webgrid is populated with the filtered and paged result.
My Stored proc handles the dynamic criteria and paging by passing in the critiera and PageIndex and PageSize.
Is SelectObjArg populated with the values from the textboxes on the form. Then in the Criteria object constructor would we pull those values and assign them to the appropriate private members of the critiera class?
I'm am confused on how to join my filtered results from the stored proc to my collection then bind it to the webgrid.
Also I'm not understanding on how "totalRowCount" is collected. Should I be returning a count of how many rows are found by the query? So my stored proc would return 2 results the first being a row count and the second being the paged results.
Each time select is called you create a NEW collection and populate it only with that one page of data. There is no cumulative merging of pages of data into a collection - this is all designed for the web, which is stateless, so you can't accumulate the data.
TotalRowCount is the total possible number of rows. Not the number in the page, but the total number. You'll almost certainly need a second SELECT statement to find this value.
Thanks for the quick reply Rocky :)
I have altered my stored proc to return 2 results the first is the total rows found. The second is the requested page of data. I have a readonly property in my Collection.
My Confusion is how to get the value from the form that is used to provide the values for the criteria of the search to the factory method because when you use the default objectbindingsource it gives you options to choice where the method parameters come from.
I guess we could alter the method below to this and pass these values on to the criteria object?
protected void CslaDataSource1_SelectObject(
object sender, Csla.Web.SelectObjectArgs e)
{
e.BusinessObject =
CslaDSTestLibrary.PersonList.GetPage(e,textbox1.text,textbox2.text);
}
Thanks again for the help I'm trying this now. I'll let ya know how it goes
The CSLA .NET Version 2.1 Handbook covers how to do this, at
least if you are letting data binding do most of the hard work for you J As
shown in the book, you can just pass the SelectObjectArgs (which contains the
data binding args) right through your criteria.
If you are manually controlling the page number/size you’d
just need to add those values to your criteria class so you can pass them
through. That shouldn’t be required if you are using the GridView or
DetailsView controls though.
Rocky
From: RangerGuy
[mailto:cslanet@lhotka.net]
Sent: Friday, February 16, 2007 11:50 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Paging is really confusing me (Need some advice
badly please help)
Thanks for
the quick reply Rocky :)
I have
altered my stored proc to return 2 results the first is the total rows found.
The second is the requested page of data. I have a readonly property
in my Collection.
My Confusion
is how to get the value from the form that is used to provide the values for
the criteria of the search to the factory method because when you use the
default objectbindingsource it gives you options to choice where the method
parameters come from.
I guess we
could alter the method below to this and pass these values on to the criteria
object?
protected void
CslaDataSource1_SelectObject(
object sender,
Csla.Web.SelectObjectArgs e)
{
e.BusinessObject
=
CslaDSTestLibrary.PersonList.GetPage(e,textbox1.text,textbox2.text);
}
Thanks again for the
help I'm trying this now. I'll let ya know how it goes
Yeh I have the 2.1 ebook :)
I have it working now :) I had to manually add the columns and pass the form values in my SelectObject method in my aspx form.
Now on to sorting :)
Thanks for the help Rocky!
Sorting is the same thing. If you are using the GridView then data binding just handles it all automatically, ensuring that you are provided with the sort information through the SelectObjectArgs parameter, and you can just pass that through to the DP_F() method.
If you are doing it all by hand, you'll need to pass appropriate fields through your Criteria object on your own.
Copyright (c) Marimer LLC