云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 总结ASPxGridView的使用 - 图文

总结ASPxGridView的使用 - 图文

  • 62 次阅读
  • 3 次下载
  • 2026/4/23 13:48:50

OnDeleting=\OnInserting=\Source1_Modifying\OnUpdating=\

SelectCommand=\* FROM [Customers]\DeleteCommand=\LETE FROM [Customers] WHERE [CustomerID] = ?\

InsertCommand=\INTO [Customers] ([CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\ UpdateCommand=\[Customers] SET [CompanyName] = ?, [ContactName] = ?, [City] = ?, [Region] = ?, [Country] = ? WHERE [CustomerID] = ?\

protected void AccessDataSource1_Modifying(object sender, SqlDataSourceCommandEventArgs e) {

DemoSettings.AssertNotReadOnly(); }

用代码实现

AccessDataSource ds = new AccessDataSource(); ds.DataFile = AccessDataSource1.DataFile;

ds.SelectCommand = \Photo from [Employees] where employeeid=\+ id;

DataView view = (DataView)ds.Select(DataSourceSelectArguments.Empty);

if(view.Count > 0) return view[0][0] as byte[]; return null;

ObjectDataSource

SelectMethod=\ />

SelectMethod=\UpdateMethod=\InsertMethod=\\

/>

ObjectDataSource.Parameters

ObjectDataSource 使用的类

(以下代码整理并修改至《ASP.NET 2.0 Revealed》P71-P78) (另外一个购物篮的例子,参考P138) public class Person {

private int id;

private string firstName; private string lastName;

public int Id {...}

public string FirstName {...} public string LastName {...}

public Person(int id, string firstName, string lastName) {

this.id = id;

this.firstName = firstName; this.lastName = lastName; } }

public class PersonCollection : List {} public class PersonManager {

private const string personsKey = \

public PersonCollection SelectPersons() {

HttpContext context = HttpContext.Current; if (context.Application[personKey] == null) {

PersonCollection persons = new PersonCollection(); persons.Add(new Person(0, \\ persons.Add(new Person(0, \\ persons.Add(new Person(0, \\ persons.Add(new Person(0, \\ context.Application[personKey] = persons; }

return context.Application[personKey] as PersonCollection; }

public Person SelectPerson(int id) {

foreach (Person p in SelectPersons()) if (p.Id == id) return p; return null; }

public void DeletePerson(int id) {

PersonCollection persons = (Application[personKey] as PersonCollections);

Person person = SelectPerson(id);

if (person != null)

persons.Remove(person); }

public void InsertPerson(int id, string firstName, string lastName) {

PersonCollection persons = (Application[personKey] as PersonCollections);

persons.Add(new Person(id, firstName, lastName)); }

public void UpdatePerson(int id, string firstName, string lastName) {

Person person = SelectPerson(id); if (person != null) {

person.FirstName = firstName; person.LastName = lastName; } } }

--(五) ASPxGridView 事件

--------------------------------------------------------- ASPxGridView

默认是以callback方式(ajax方式)传递数据给服务器来实现局部刷新功能的 若要改为postback方式,可设置 EnableCallBacks = \

--------------------------------------------------------- 展示视图

---------------------------------------------------------

RowCreated(创建行数据时触发,类似 GridView 的 DataItemCreate 事件) protected void grid_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e) {

if(e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;

// 设置模板列lable控件值

Label label = grid.FindRowCellTemplateControl(e.VisibleIndex, null, \hangePercent\as Label;

decimal change = (decimal)grid.GetRowValues(e.VisibleIndex, \e\

搜索更多关于: 总结ASPxGridView的使用 - 图文 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

OnDeleting=\OnInserting=\Source1_Modifying\OnUpdating=\ SelectCommand=\* FROM [Customers]\DeleteCommand=\LETE FROM [Customers] WHERE [CustomerID] = ?\ InsertCommand=\INTO [Customers] ([CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com