如何将 Telerik RadGrid 默认设置为编辑模式? (ASP.NET)

发布于 2024-10-06 04:21:46 字数 248 浏览 0 评论 0原文

我在 RadGrid 中有一个复选框列,我希望用户能够选中/取消选中它并设置附加属性。但是,当网格呈现时,复选框将被禁用,因为网格不处于“编辑模式”。我找到的所有示例都希望我经历选择记录、将其置于编辑模式、更改值、保存值的漫长过程。... yada yada yada ...

我只想整个网格从一开始就处于编辑模式(或列,或任何有效的模式),因此最终用户可以对数据值进行一键更改。

我知道一定有办法做到这一点,但我似乎找不到。

帮助?

I have a checkbox column in a RadGrid that I want the user to be able to check/uncheck it and set the attached property. When the grid renders however, the checkboxes are disabled, because the grid is not in "edit mode". All the examples I'm finding want me to go through a lengthy process of selecting the record, putting it into edit mode, changing the value, saving the value.... yada yada yada...

I just want the whole grid to be in edit mode (or the column, or whatever works) from the get-go, so the end user can make a one-click change to the data value.

I know there must be a way to do this, I just can't seem to find it.

Help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

还不是爱你 2024-10-13 04:21:46

您可以通过调用网格的预渲染事件将其置于编辑模式。

下面是一些用于执行此操作的示例 C# 代码。

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (IsPostBack) return;

    foreach (var item in RadGrid1.MasterTableView.Items)
    {
        var editableItem = item as GridEditableItem;
        if (editableItem == null) continue;

        editableItem.Edit = true;
        PreviewRadGrid.Rebind();
    }       
}

http://www.telerik.com/help/aspnet/grid/grddefaulteditmodeforgriditemsoninitialload。 html

You can put it into edit mode by calling on the pre-render event for the grid.

Here is some sample C# code to do that.

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (IsPostBack) return;

    foreach (var item in RadGrid1.MasterTableView.Items)
    {
        var editableItem = item as GridEditableItem;
        if (editableItem == null) continue;

        editableItem.Edit = true;
        PreviewRadGrid.Rebind();
    }       
}

http://www.telerik.com/help/aspnet/grid/grddefaulteditmodeforgriditemsoninitialload.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文