- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要向我的 RadGrid
实例添加多个页脚行;但是,目前我只想添加第二个。我目前只有一个页脚行,它可以完美地工作和显示,以供记录。
我找到了 the following relevant question在 Telerik 论坛上并尝试实现它但它不起作用:代码被执行,新的 FooterItem
被添加到 Controls
但第二行没有出现.我需要找出原因,如果有人能帮我解决这个问题,我将不胜感激。
ASP网格代码
<div id="OrderMainContent">
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1" />
<telerik:AjaxSetting AjaxControlID="txtQuantity">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadInputManager ID="RadInputManager1" runat="server">
<telerik:NumericTextBoxSetting BehaviorID="NumericBehavior1" Type="Number" DecimalDigits="0">
<TargetControls>
<telerik:TargetInput ControlID="RadGrid1" />
</TargetControls>
</telerik:NumericTextBoxSetting>
</telerik:RadInputManager>
<telerik:RadGrid ID="RadGrid1" runat="server" Skin="Sunset" AllowSorting="True" AutoGenerateColumns="False"
GridLines="None" ShowFooter="True" OnItemDataBound="RadGrid1_ItemDataBound" OnPreRender="RadGrid1_PreRender">
<MasterTableView DataKeyNames="ProductID" TableLayout="Fixed">
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn UniqueName="colProduct" HeaderText="<%$ Resources: SiteLabels, ProductOrderForm.lblProduct %>"
HeaderStyle-HorizontalAlign="Center" DataField="ProdDesc">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn UniqueName="colQuantity" HeaderText="<%$ Resources: SiteLabels, ProductOrderForm.lblQuantity %>"
HeaderStyle-HorizontalAlign="Center" DataField="OrderQty" ColumnEditorID="txtQuantity">
<HeaderStyle Width="90" />
<ItemStyle Width="90px" />
<ItemTemplate>
<asp:TextBox ID="txtQuantity" runat="server" Width="50px" OnTextChanged="txtQuantity_TextChanged"
AutoPostBack="true">
</asp:TextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="colPrice" HeaderText="<%$ Resources: SiteLabels, ProductOrderForm.lblBasePrice %>"
HeaderStyle-HorizontalAlign="Center" DataField="ProdUnitPrice">
<HeaderStyle Width="80px" />
<ItemStyle Width="80px" />
<ItemTemplate>
<asp:Label ID="lblPrice" runat="server" Text='<%# Eval("ProdUnitPrice") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn UniqueName="colNotes" HeaderText="<%$ Resources: SiteLabels, ProductOrderForm.lblNotes %>"
HeaderStyle-HorizontalAlign="Center">
<HeaderStyle Width="200px" />
<ItemStyle Width="200px" />
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
</telerik:RadGrid>
</div>
相关代码背后
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
AddFooterRow(sender as RadGrid);
}
private void AddFooterRow(RadGrid grid)
{
if (grid != null)
{
GridItem[] footerItems = grid.MasterTableView.GetItems(GridItemType.Footer);
if (footerItems.Count() == 1)
{
GridTFoot foot = footerItems[0].Parent.Controls[0].Parent as GridTFoot;
for (int i = 0; i < foot.Controls.Count; i++)
{
GridFooterItem item = foot.Controls[i] as GridFooterItem;
if(item != null)
{
lastFooterPos = i;
break;
}
}
GridFooterItem existingFooter = foot.Controls[lastFooterPos] as GridFooterItem;
GridFooterItem newFooterItem = new GridFooterItem(grid.MasterTableView, 0, 0);
foreach(TableCell fc in existingFooter.Cells)
{
TableCell newFooterCell = new TableCell();
newFooterCell.Text = "allo";
newFooterItem.Cells.Add(newFooterCell);
}
foot.Controls.AddAt(lastFooterPos + 1, newFooterItem);
}
}
}
当然,如果您需要更高的精度,请直接询问。感谢您的帮助。
最佳答案
在对 Telerik 文档进行一些搜索后,我相当确定这不仅是可能的。在 this question ,例如,Telerik 管理员明确指出“RadGrid 是数据绑定(bind)控件,其项目是根据其数据源中的记录创建的,并显示数据源数据。因此,为了在网格中添加新行,您需要在其数据源中添加新记录并重新绑定(bind)网格。"
因此,为了解决我的问题,我决定删除网格上的页脚并在下方添加一个全新的网格,我将其绑定(bind)到虚拟 DataTable
我将通过我的 Page_Load
事件处理程序中的代码创建。这些值将通过 Javascript 在客户端确定,或者简单地注入(inject)到该虚拟表的行中。
如果有人找到更优雅的解决方案,我仍然有兴趣了解它!不过现在,工作必须向前推进。
关于c# - Telerik Radgrid : adding another footer row,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15572095/
我在使用 CodedUI 时遇到了 Silverlight 中选项卡的 telerik 控件的问题。我可以使用 CodedUI 记录我在选项卡中执行的操作,但是当我开始执行 CodedUI 测试时,它
我将网格与 Telerik 的“客户端选择”(http://demos.telerik.com/aspnet-mvc-beta/grid/selectionclientside) 一起使用,并且我的页
我知道我需要使用模板列,但我不清楚如何使用它。 我有一个返回集合的数据源,我可以将集合中的每个属性分配给一个列。 但是我该怎么做: 合并两列?如 col.prop1 +' '+ col.prop2 ?
我有一个 Telerik MVC 网格,其中包含一个 bool 值 CreateIncident。对于新行,我想将该值设置为 true。对于编辑,如果该值已经为真,我想禁用该复选框。剑道 UI 显然是
我使用的是 Telerik 的 RadGrid(RadGrid.Net2(我知道我应该升级到更新的版本,但这里不是一个选项..))。它的功能之一是将数据导出到 excel。使用 grid.Master
我在 asp .net 中创建了一个 telerik RadGrid。我的要求是为列标题提供我自己的颜色。我们怎样才能做到这一点...?下面是我正在使用的代码结构。
是否可以使用 Telerik MVC 扩展在链接标签上设置媒体属性 StyleSheetRegistrar方法? group .Add("telerik.common.css")
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 6年前关闭。 Improve thi
我在 Telerik MVC Grid 中有一个 DateTime 类型的列。我只想使用它的 Date 部分进行显示和过滤。结果,我使用了以下代码 @(Html.Telerik().Grid()
Xamarin 用 C# 编写模型 用每个操作系统自己的 native 方式编写 View Xamarin promise 在同一天添加库中的新功能 Telerik native 脚本 用 javas
我想在 TreeView 中选择子项时获取父项,并且还想查找所选节点是父节点还是子节点。 如果有人知道如何实现它,请告诉我。 提前致谢, 钦纳亚 最佳答案 为了获取所选节点,您需要使用 select事
我有一个使用自定义编辑模板的弹出编辑模式的radgrid。按下回车键后的编辑表单会将新项目插入网格。我进去添加一个项目。成功插入。然后我添加第二个项目:出现弹出窗口。我输入数据,然后按“输入”键插入项
我试图在预渲染事件中隐藏/显示嵌套telerik rad网格上的不同列,基于一个标志,但无论我将可见或显示属性设置为什么,它们都显示 这些是我的网格列:
我们如何删除以前在 Telerik RadGrid 上在 Post Back 上完成的数据排序。 最佳答案 将主表 View 的 SortExpression 设置为清除。 例子: _rdGrdRep
Telerik Rad Grid 中 ajax 完成事件的名称是什么?我尝试了文档中的内容,但出现以下错误 Parser Error Message: Type 'Telerik.Web.UI.Gri
我正在使用 Telerik 的 MVC 网格,并且我想提交带有一些超出网格值的批量编辑模式更改。根据这个telerik forum我可以调用网格的 submitChanges 函数并在 OnSubmi
我目前正在更改一个网站,该公司希望将所有内容从 Telerik 更改为 Kendo。 我现在遇到了一些麻烦。在 BindTo 方法中可以有一些映射,而 .ItemDataBound 。在那,你可以设置
有人知道更改 MVC 网格的 Telerik 扩展的高度的方法吗?除了使用 手动覆盖样式之外 div#MyGrid .t-grid-content { height: 100px !impor
我在我的 ASP.NET MVC 3 razor 应用程序中使用最新版本的 Telerik MVC 扩展。我还下载了最新版本的 jQuery。 我的 jQuery 文件与 Visual Studio
Telerik's Wiki 中似乎没有任何关于通过用于 MVC 的 Telerik Grid 的客户端 API 进行分组的文档。并且 Google 结果没有提供任何特定于客户端 api 和通过 ja
我是一名优秀的程序员,十分优秀!