本文整理匯總了C#中System.Web.UI.WebControls.LinqDataSourceSelectEventArgs類的典型用法代碼示例。如果您正苦於以下問題:C# LinqDataSourceSelectEventArgs類的具體用法?C# LinqDataSourceSelectEventArgs怎麽用?C# LinqDataSourceSelectEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LinqDataSourceSelectEventArgs類屬於System.Web.UI.WebControls命名空間,在下文中一共展示了LinqDataSourceSelectEventArgs類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: LinqDataSource_Selecting
protected void LinqDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
ExampleDataContext exampleContext = new ExampleDataContext();
e.Result = from p in exampleContext.Products
where p.Category == "Beverages"
select new {
ID = p.ProductID,
Name = p.Name
};
}
示例2: Page_Load
public partial class Default3 : System.Web.UI.Page
{
string[] citiesArray =
{
"Atlanta",
"Charlotte",
"Denver",
"New York",
"San Francisco"
};
protected void Page_Load(object sender, EventArgs e)
{
}
protected void LinqDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
var cities = from city in citiesArray
where city.CompareTo("B") > 0
select city;
e.Result = cities;
// Or we could set e.Result = citiesArray to return all rows.
}
}