使用RowDatabound()和Databound()时的困惑 [英] Confusion in using of RowDatabound() and Databound()

查看:70
本文介绍了使用RowDatabound()和Databound()时的困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的页面中我使用gridview1,因为我是RowCommand(),RowDatabound()和Databound()。我的想法是。是否有必要使用RowDatabound()和Databound()。我们不能像RowDatabound()那样使用sigle,我们无法实现像Databound()

In my page i am using gridview1 for that i am RowCommand(), RowDatabound() and Databound().my dought is. Is it Necessary to use RowDatabound() and Databound().cant we use sigle one like RowDatabound() and we cant achieve same functionality like Databound()

推荐答案

这样的功能。我在这里给出了类似的答案:

​​ DataBound和RowDataBound [ ^ ]



在呈现GridView控件之前,控件中的每一行都必须绑定到数据源中的记录。当数据行(由GridViewRow对象表示)绑定到GridView控件中的数据时,将引发 RowDataBound 事件。这使您能够提供执行自定义例程的事件处理方法,例如,每当发生此事件时,修改绑定到行的数据的值。

参考:

MDSN:GridView.RowDataBound事件 [< a href =http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspxtarget =_ blanktitle =New Window> ^ ]

MDSN:GridView。 OnRowDataBound方法 [ ^ ]



我们在服务器控件绑定后想要做某些事情时使用gridview DataBound 事件到数据源。例如,在绑定之后,我们可能希望在网格底部显示一些文本,或者我们可能想要计算列的总值。

MSDN:GridView.DataBind方法 [ ^ ]

MSDN:GridView.DataBind方法() [ ^ ]



希望现在你很清楚。 :)

- Amit
See the similar answer I''ve given here:
DataBound and RowDataBound[^]

Before the GridView control can be rendered, each row in the control must be bound to a record in the data source. The RowDataBound event is raised when a data row (represented by a GridViewRow object) is bound to data in the GridView control. This enables you to provide an event-handling method that performs a custom routine, such as modifying the values of the data bound to the row, whenever this event occurs.
Refer :
MDSN : GridView.RowDataBound Event[^]
MDSN : GridView.OnRowDataBound Method[^]

We use gridview DataBound event when we want to do certain things after the server controls bind to the datasource. For example after the binding we may want to display some text at the bottom of the grid or we might want to calculate the total value of a column.
MSDN : GridView.DataBind Method[^]
MSDN : GridView.DataBind Method ()[^]

Hope now it''s clear to you. :)
--Amit


这篇关于使用RowDatabound()和Databound()时的困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆