文章分类 | 推荐文章 | 最新文章 | 热点文章 | 最新软件 | 精品软件 | 下载排行 | 推荐下载 | 免费看大片 | WPS | 杀毒软件
清风网络
首 页 软件下载 网络学院 数码学院
QQ 电脑入门 游戏 操作系统 图形处理 办公软件 媒体动画 精文荟萃 工具软件 网络编程 程序开发 网络技术 认证考试 网站建设 文章专栏
当前位置:清风网络学院网络编程Asp.NetDataGrid常见关注问题解决方案
精品推荐
特别推荐
·技巧实例:ASP.NET生成静态页面实现方法
·ASP.NET、JSP及PHP之间的抉择
·.net基础知识错误注意二十二点知识
·asp.net2.0学习历程 菜鸟到中级程序员的飞跃
·.NET基础知识-什么是.NET
·初学C#+ASP.NET+Oracle时积累的备忘点滴
·专家详解:复杂表达式的执行步骤
·asp.net中的加密方法
·DataGrid常见关注问题解决方案
·学习笔记 ASP.NET 5种页面转向法
·ASP.NET网络编程中经常会用到的27个函数集
·ASP.NET之上传文件管理策略
·专家:用.NET动态创建类的实例讲解
·ASP.NET WEB服务和Flash打造MP3播放器
·精通ASP.NET中弹出窗口技术
·asp.net常用代码
·asp.net创建文件夹的IO类的问题
·Asp.Net函数集
·Asp.net cache 简述
·如何最大限度提高.NET的性能 (续)
热点TOP10
·DataTable控件的使用
·ASP.NET上传文件的实例
·ASP.NET2.0下含有DropDownList的GridView编辑、删除的完整例子!
·asp.net(C#)海量数据表高效率分页算法(易懂,不使用存储过程)
·ASP.NET购物车的实现及结算处理
·在ASP.NET中防止注入攻击[翻译]
·使用ASP.NET2.0的ReportViewer查看RDLC报表
·asp.net程序中最常用的三十三种编程代码
·ASP.NET 2.0的导航控件treeview和menu的实例
·asp.net常用代码
·Lucene.net 实现全文搜索
·在C#后代码里使用IE WEB Control TreeView
·asp.net2.0学习历程 菜鸟到中级程序员的飞跃
·Access 通用数据访问类(asp.net 2.0 c#)
·.Net分页控件发布
·ASP.NET之上传文件管理策略
·AspNetPager分页控件--使用方法
·asp.net 2.0中gridview里嵌套dropdownlist
·手把手教你在Win2003下配置ASP.NET开发环境
·ASP.net在线购物商城系统完全解析

DataGrid常见关注问题解决方案

日期:2007年7月15日 作者:清风网络学院 查看:[大字体 中字体 小字体]


Dim bookid As Integer = CType(bookidlabel.Text, Integer)
If Not (bookidlist.Contains(bookid)) Then
bookidlist.Add(bookid)
End If
End Sub

// C#
protected void RowChanged( object sender, System.EventArgs e)
{
DataGridItem dgi = (DataGridItem)(((Control)sender).NamingContainer);
Label bookidlabel = (Label) dgi.Cells[0].Controls[1];
int bookid = int.Parse(bookidlabel.Text);
if (!bookidlist.Contains(bookid))
{
bookidlist.Add(bookid);
}
}
Note The method cannot be private, or you will not be able to bind to it later.
It is helpful to understand that change events do not, by default, post the page back to the server. Instead, the event is raised only when the page is posted some other way (usually via a Click event). During page processing, the page and its controls are initialized, and then all change events are raised. Only when the change event's handlers have finished is the Click event raised for the control that caused the post.

On to the RowChanged method illustrated above. The code needs to get the book ID out of the current item. The event does not pass the item to you (as it does for many DataGrid events, for example), so you have to work backwards. From the sender argument of the event, get the NamingContainer property, which will be the grid item. From there, you can drill back down to get the value of the Label control that displays the book ID.

You need to check that the book ID is not already in the array. Each control in the row raises the event individually, so if there has been a change in more than one control, you could potentially end up adding the book ID to the array more than once.

The change events for controls are always raised and handled before click events. Therefore, you can build the array list in the change event and know that it will be available when the event handler runs for the button click that posted the form (in this example, the btnUpdate_Click handler).

Now that you have the array list, you can make a minor modification to the handler that manages the update. In the btnUpdate_Click, when you iterate through the data grid items, add a test to see if the current book ID is in the array list; if so, make the update.

' Visual Basic
Private Sub btnUpdate_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnUpdate.Click
Dim i As Integer
Dim dgi As DataGridItem
'Rest of declarations here

上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] 下一页 




上一篇:自己写的一个简单ASP调用存储过程查询

下一篇:使用ASP与JAVASCRIPT配合实现多个复选框数据关联显示

DataGrid常见关注问题解决方案 相关文章:
·XP系统运行慢?小编自用7招解决
·《边看边打赚大奖--迅雷宽频》部分问题及答案
·不用重装XP系统就可以解决全部故障
·校园网组建方案
·施工与工程组织方案
·全面解决Generic host process for win32 services遇到问题需要关闭
·经典常见计算机密码破解实用手册
·[综合]召唤兽常见技能资质表(最新修补完整版)
·国内大学校园网网络建设方案参考
·外挂 录象 网站 举报方案最新教程_QQ堂
DataGrid常见关注问题解决方案 相关软件:
·网络常见问题与故障1000例
·成功少儿培养方案(上中下)高清晰PDF电子书
·有关毛泽东的一些问题解答(不完整版)
·中东问题的历史根源
·每天问自己十个问题
·动网先锋系统集成方案大全
·《常见皮肤性病诊断与治疗》
·生命问题
·百度知道 1850个经典问题
·SmartGrid表格控件 for Asp.Net(Web Grid,DataGrid) V2.0 For VS2005

特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
[打印本页] [关闭窗口] 转载请注明来源:http://www.vipcn.net
| 帮助(?) | 版权声明 | 友情连接 | 关于我们 | 信息发布
Copyright 2007 www.vipcn.net All Rights Reserved. 鄂ICP备05000083号Powered by:viphot