Jan 30, 2009, 11:01 AM
can not get DataSourceProxy to work
Hi,
I am trying to make nearly the exact implementation of the sample "Paging And Sorting" on the examples page.
but, when i put the DataSourceProxy item in ext:Store, i get an empty result set.
If i remove it, i get only the 10 records (which is the limit in my case).
You can see the following code for the sample, but its not much different than the sample.
Any suggestions for that behaviour ?
Thanks.
I am trying to make nearly the exact implementation of the sample "Paging And Sorting" on the examples page.
but, when i put the DataSourceProxy item in ext:Store, i get an empty result set.
If i remove it, i get only the 10 records (which is the limit in my case).
You can see the following code for the sample, but its not much different than the sample.
Any suggestions for that behaviour ?
Thanks.
<asp:ObjectDataSource ID="ObjectDataSource1" SelectMethod="GetMyList"
OnSelected="ObjectDataSource1_Selected" TypeName="oo.ObjectData" runat="server">
<SelectParameters>
<asp:Parameter Name="start" DefaultValue="1" Type="Int32" />
<asp:Parameter Name="limit" DefaultValue="10" Type="Int32" />
<asp:Parameter Name="sort" DefaultValue="" />
<asp:Parameter Name="dir" DefaultValue="" />
<asp:Parameter Name="count" Direction="Output" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
<ext:Store ID="Store1" runat="server" AutoLoad="true" RemoteSort="true" DataSourceID="ObjectDataSource1">
<Proxy>
<ext:DataSourceProxy />
</Proxy>
<Reader>
<ext:JsonReader ReaderID="id">
<Fields>
<ext:RecordField Name="FirstName" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
namespace oo
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;
public class ObjectData
{
public static DataTable GetMyList(
int start,
int limit,
string sort,
string dir,
out int count
)
{
try
{
Database db = DatabaseFactory.CreateDatabase();
string sqlCommand = "SP_GetMyList";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
db.AddInParameter(dbCommand, "start", DbType.Int32, start);
db.AddInParameter(dbCommand, "limit", DbType.Int32, limit);
db.AddInParameter(dbCommand, "sort", DbType.String, sort);
db.AddInParameter(dbCommand, "dir", DbType.String, dir);
db.AddOutParameter(dbCommand, "TotalCount", DbType.Int32, count);
ds = db.ExecuteDataSet(dbCommand);
count = Convert.ToInt32(db.GetParameterValue(dbCommand, "TotalCount"));
}
catch (Exception ex)
{
ExceptionManager.Publish(ex);
}
return ds.Tables[0];
}
}
}