.net GridViewRow.RowType 属性
来源:互联网 发布:一辈子做女孩知乎评论 编辑:程序博客网 时间:2024/06/05 11:52
以下内容来自MSDN
注意:此属性在 .NET Framework 2.0 版中是新增的。
获取 GridViewRow 对象的行类型。
命名空间:System.Web.UI.WebControls
属性值
DataControlRowType 值之一。
备注
使用 RowType 属性确定 GridViewRow 对象表示的行的类型。下表列出了不同的行类型值。
此属性通常用于在执行一个操作前确定行的类型。
示例
下面的示例演示如何使用 RowType 属性确定要创建的行是否为脚注行。如果该行是脚注行,列的总和值将更新到脚注行。
<%@ Page language="C#" %>
<script runat="server">
// Create a variable to store the order total.
private Decimal orderTotal = 0.0M;
void OrderGridView_RowCreated(Object sender, GridViewRowEventArgs e)
{
// Retrieve the current row.
GridViewRow row = e.Row;
// Update the column total if the row being created is
// a footer row.
if (row.RowType == DataControlRowType.Footer)
{
// Get the OrderTotalTotal Label control in the footer row.
Label total = (Label)e.Row.FindControl("OrderTotalLabel");
// Display the grand total of the order formatted as currency.
if (total != null)
{
total.Text = orderTotal.ToString("c");
}
}
}
void OrderGridView_RowDataBound(Object sender, GridViewRowEventArgs e)
{
// Retrieve the current row.
GridViewRow row = e.Row;
// Add the field value to the column total if the row being created is
// a data row.
if (row.RowType == DataControlRowType.DataRow)
{
// Get the cell that contains the item total.
TableCell cell = e.Row.Cells[2];
// Get the DataBoundLiteralControl control that contains the
// data bound value.
DataBoundLiteralControl boundControl = (DataBoundLiteralControl)cell.Controls[0];
// Remove the '$' character for the type converter to work properly.
String itemTotal = boundControl.Text.Replace("$", "");
// Add the total for an item (row) to the order total.
orderTotal += Convert.ToDecimal(itemTotal);
}
}
</script>
<html>
<body>
- .net GridViewRow.RowType 属性
- Asp.net 如何获取GridViewRow
- %ROWTYPE
- PLSQL的两个属性类型%type 和%rowtype
- PLSQL的两个属性类型%type 和%rowtype
- 期待.net 支持数据库存储过程列类型参数 %rowtype
- 列表中的GridViewRow事件
- %ROWTYPE-cursors
- Oracle %ROWTYPE
- ORACLE %ROWTYPE
- 温故知新-ROWTYPE
- Oracle PL/SQL中如何使用%TYPE和%ROWTYPE 转载自(王朝网络 wangchao.net.cn)
- ASP.NET问题e.Row.RowType == DataControlRowType.DataRow的用法
- .NET 属性
- (sender as ImageButton).NamingContainer as GridViewRow
- 获取gridviewrow索引值的方法。。。
- %type %rowtype 区别
- %type %rowtype 区别
- 什么是面向服务的体系结构(SOA)?
- oracle临时表的用法总结
- 读取C# Textbox控件中包含中文内容的长度
- 购物车详细代码
- 从表中取第n条到第m条记录
- .net GridViewRow.RowType 属性
- 如何在子窗体中操作主窗体上的控件
- js_getElementsByName的ie,firefox区别
- Linux环境下USB的原理、驱动和配置
- .net GridView.RowDataBound 事件
- 什么是annotations
- 项目总结
- xml解析在不连接网络的情况下报错
- A potentially dangerous Request.Form value was detected from the client