да,
Вы должны указать метод выбора, метод счета, метод выбора, выражение SorExpression, имя типа.
В методе select вы должны указать статический метод с общим именем, по которому вы запустили запрос.
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
EnablePaging="true" OnSelecting="ObjectDataSource1_Selecting"
TypeName="WebApplication1.MinimalObjectDataSourceObject"
SelectMethod="MinimalSelectMethod" SelectCountMethod="MinimalSelectCountMethod" />
ДЕКЛАРАЦИЯ КЛАССА
public class MinimalObjectDataSourceObject
{
// A nice list for demonstration purposes.
private static List<CultureInfo> baseList = new List<CultureInfo>(CultureInfo.GetCultures(CultureTypes.AllCultures));
// Our minimal SelectMethod.
public static List<CultureInfo> MinimalSelectMethod(string parameter1, string parameter2, int startRowIndex,
int maximumRows)
{
List<CultureInfo> someList = GetSomeKindOfList(parameter1, parameter2);
// Make sure we don't try to get objects that don't exist, ArgumentOutOfRangeException otherwise!
if (startRowIndex + maximumRows > someList.Count)
{
maximumRows = someList.Count - startRowIndex;
}
return someList.GetRange(startRowIndex, maximumRows);
}
// Our minimal SelectCountMethod.
public static int MinimalSelectCountMethod(string parameter1, string parameter2)
{
return GetSomeKindOfList(parameter1, parameter2).Count;
}
// A method to get a filtered list for our primary data source.
public static List<CultureInfo> GetSomeKindOfList(string parameter1, string parameter2)
{
return baseList.FindAll(x => x.EnglishName.ToLower().StartsWith(parameter1))
.FindAll(x => string.IsNullOrEmpty(parameter2.ToLower()) ||
x.EnglishName.ToLower().EndsWith(parameter2.ToLower()));
}
}