本文整理匯總了C#中System.Web.UI.WebControls.ObjectDataSource.SelectCountMethod屬性的典型用法代碼示例。如果您正苦於以下問題:C# ObjectDataSource.SelectCountMethod屬性的具體用法?C# ObjectDataSource.SelectCountMethod怎麽用?C# ObjectDataSource.SelectCountMethod使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Web.UI.WebControls.ObjectDataSource
的用法示例。
在下文中一共展示了ObjectDataSource.SelectCountMethod屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: rowsToDisplay_SelectedIndexChanged
protected void rowsToDisplay_SelectedIndexChanged(object sender, EventArgs e)
{
GridView1.PageSize = int.Parse(rowsToDisplay.SelectedValue);
}
示例2: GetSubsetOfEmployees
public class CustomerLogic
{
public List<Customer> GetSubsetOfEmployees(int startRows, int maxRows)
{
NorthwindDataContext ndc = new NorthwindDataContext();
var customerQuery =
from c in ndc.Customers
select c;
return customerQuery.Skip(startRows).Take(maxRows).ToList<Customer>();
}
public int GetEmployeeCount()
{
object cachedCount = HttpRuntime.Cache["TotalEmployeeCount"];
if (cachedCount != null)
{
return int.Parse(cachedCount.ToString());
}
else
{
NorthwindDataContext ndc = new NorthwindDataContext();
var totalNumberQuery =
from c in ndc.Customers
select c;
int employeeCount = totalNumberQuery.Count();
HttpRuntime.Cache.Add("TotalEmployeeCount", employeeCount, null, DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
return employeeCount;
}
}
}