- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的 asp.net web 表单中有一个 Telerik RadGrid,如下所示:
MasterTableView
DetailTables -> GridTableView
在那个细节表中,我有一列如下:
<telerik:GridTableView runat="server" DataKeyNames="ID,Customer_ID,CardType_ID,OrderStatus_ID"
DataSourceID="sdsOrders" AllowFilteringByColumn="True"
AllowMultiColumnSorting="True" AllowSorting="True" ShowFooter="True" OnDataBinding="GridTableView_DataBinding">
...
<telerik:GridBoundColumn DataField="TotalPrice" DataType="System.Int32" FilterControlAltText="Filter TotalPrice column"
HeaderText="TotalPrice" SortExpression="TotalPrice"
UniqueName="TotalPrice" AllowFiltering="False" FooterText="Sum: " Aggregate="Sum">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
</telerik:GridBoundColumn>
我想更改页脚文本 (Sum) 和页脚 (Sum) 的颜色。
对于 MasterTableView 中的 DataBoundColumns,下面的代码有效:
protected void GridTableView_DataBinding(object sender, EventArgs e)
{
GridBoundColumn TotalPrice = grdCustomers.MasterTableView.GetColumnSafe("TotalPrice") as GridBoundColumn;
TotalPrice.FooterAggregateFormatString = "<span class=\"AggregateTitleColor\">Sum : </span>" + "{0:#,0 ;#,0- }";
TotalPrice.FooterStyle.ForeColor = ColorTranslator.FromHtml("blue");
}
现在如何为 DetailTable 中的 TotalPrice 重写这些代码?
提前致谢
最佳答案
我找到了答案:
首先应该在 MasterTableView 中使用 DataBinding。
并像这样重写代码:
protected void MasterTableView_DataBinding(object sender, EventArgs e) <- Pay Attention Here
{
GridBoundColumn TotalPrice = grdCustomers.MasterTableView.DetailTables[0].GetColumnSafe("TotalPrice") as GridBoundColumn;
TotalPrice.FooterAggregateFormatString = "<span class=\"AggregateTitleColor\">Sum : </span>" + "{0:#,0 ;#,0- }";
TotalPrice.FooterStyle.ForeColor = ColorTranslator.FromHtml("blue");
}
你就完成了。
关于c# - 如何在 CodeBehind 的 DetailTable 中访问 FooterText (Telerik-RadGrid)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11234661/
将 RadGrid 用于 Asp.Net Ajax(来自 Telerik) 我需要重新设置 CurrentPageIndex。 Some examples说下一行代码应该是 myGrid.Rebind
Telerik Rad 控件在浏览器中仅显示为实线。但在 Visual Studio 设计中它显示正确。 There are no records to display
当我单击添加记录按钮时,我希望其中一列具有默认值。我如何在后面的代码中做到这一点?它是一个动态日期并且可以一直更改? 最佳答案 如果该列不是 GridTemplateColumn ,您可以使用列的 D
我正在尝试设置一个切换开关,以便用户可以将对象列表用作待办事项列表。我正在寻找一种用户可以单击一行的方法,并且它将跨度从一个字体图标切换到另一个字体图标。我还希望根本不访问服务器。 目前我有这个 Ja
我有一个使用 OnNeedDataSource 动态加载数据的 Telerik RadGdir。绑定(bind)所有数据后,我想使用 PreRender 事件添加一个页脚行,该行将包含描述网格数据的文
在their documentation Telerik 说有一种方法可以通过使用 AllowSorting 属性来禁用特定列的排序。我在看 Telerik.Web.UI.GridColumn mem
我有一个简单的辐射网格。当我单击“添加记录”时它会弹出一个插入模板,它会以垂直格式显示表单,我想更改它以使其以水平格式显示吗?我该怎么做? protected void Page_Load(objec
我想要 RADGRID 中的复选框。详细要求如下: 我正在使用存储过程中的 AutoGenerateColumns="True"填充所有 radgrid 列。我需要一个额外的复选框列。 在网格加载期间
我在使用 telerik radgrid 控件时遇到问题。当网格处于编辑模式时,我正在尝试使用 javascript 访问文本框。 我的代码如下所示:
我有一些嵌套的 div,其中一个包含需要填充其容器的 Radgrid 控件。 尝试了 100% 高度/宽度。没用。 试过绝对定位。没用。 遵循 Telerik 的建议 here .不。 按照这个pos
我有一个 radgrid asp.net 控件,我在其中编辑服务器端的行。我想在客户端知道用户是否在保存/放弃网格中的更改之前尝试关闭屏幕。 我找到了一些关于如何使用 get_masterTableV
我的 radgrid (RAD13) 有这个手动更新代码。上传时它有效,但问题是只有网格中的第一行保存它的更新。 我认为我应该传递一个自动递增的值来遍历行 protected void UpdateB
我有一个 RadGrid,它有一个像这样的列: /> /> 我想对其进行设置,以便此列在插入新值时允许输入,但在更新值时
我需要在 Telerik RadGrid Row Double Click 上触发客户端事件,并通过单击从服务器获取更新。但是双击事件不起作用。如果我删除“EnablePostBackOnRowCli
我可以根据后面代码中的数据为每列创建不同的控件,并且它可以工作。 我想在代码后面的每一行创建不同的控件。示例: ColumnA ColumnB
我在页面上有一个 RadGrid,当您单击该行时会回发,配置如下: 我试图通过以下方式停止事件的传播来停止回发: function RowClick(sender, e) {
我正在使用 RadGrid 从数据库中检索数据。我的 RadGrid 中有更多列,因此我需要显示 RadGrid 水平滚动以防止页面展开但禁用垂直滚动以便网格的高度应该展开以始终显示网格中的所有行。我
如何将代码中的“DurationType”列设置为下拉菜单? 我已经修改了代码以展示如何创建模板和添加下拉菜单。但我不知道如何获取下拉列表的值,因为它只显示在插入/编辑模板中,而不是常规网格中。 pr
我有一个 RadGrid,其中我想创建的列数未知。其实我知道第一列,它有一个数据字段PermissionName。我有一个 CSLA 数据源,它返回一个 PermissionInfo 对象列表,每个对
我需要在某些列上创建一个包含多个组的网格,我的代码是
我是一名优秀的程序员,十分优秀!