Telerik RadDock - ajax 更新返回 JSON 错误

发布于 2024-07-19 00:48:29 字数 1484 浏览 3 评论 0原文

尝试通过将 RadDock 放入 UpdatePanel 中来更新 RadDock(打开/关闭它),但是没有运气......我收到以下响应。

189|error|500|Invalid JSON primitive: {"Top":179,"Left":583,"DockZoneID":"","Collapsed":false,"Pinned"

:假,“可调整大小”:假,“关闭”:假,“宽度”:“300px”,“高度”:null,“ExpandedHeight”:0,“索引”:-1} .|

这是代码:

<asp:UpdatePanel ID="upanelDock" runat="server">
    <ContentTemplate>
        <telerik:RadDock ID="RadDock1" runat="server" Width="300px">
            <TitlebarTemplate>
                <h2>
                    this is a dock</h2>
            </TitlebarTemplate>
            <ContentTemplate>
                some content here
                <br />
                some content here
                <br />
                some content here
                <br />               
            </ContentTemplate>
        </telerik:RadDock>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="lbtnUpdate" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
<asp:LinkButton ID="lbtnUpdate" runat="server" OnClick="lbtnUpdate_Click">update</asp:LinkButton>

代码背后:

    protected void lbtnUpdate_Click(object sender, EventArgs e)
{

    if (this.RadDock1.Closed)
        this.RadDock1.Closed = false;
    else
        this.RadDock1.Closed = true;
}

我在这里做错了什么?

Trying to update RadDock (open/close it) by putting it in UpdatePanel however no luck....I'm getting the following response.

189|error|500|Invalid JSON primitive: {"Top":179,"Left":583,"DockZoneID":"","Collapsed":false,"Pinned"

:false,"Resizable":false,"Closed":false,"Width":"300px","Height":null,"ExpandedHeight":0,"Index":-1}
.|

Here is the code:

<asp:UpdatePanel ID="upanelDock" runat="server">
    <ContentTemplate>
        <telerik:RadDock ID="RadDock1" runat="server" Width="300px">
            <TitlebarTemplate>
                <h2>
                    this is a dock</h2>
            </TitlebarTemplate>
            <ContentTemplate>
                some content here
                <br />
                some content here
                <br />
                some content here
                <br />               
            </ContentTemplate>
        </telerik:RadDock>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="lbtnUpdate" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
<asp:LinkButton ID="lbtnUpdate" runat="server" OnClick="lbtnUpdate_Click">update</asp:LinkButton>

Code behind:

    protected void lbtnUpdate_Click(object sender, EventArgs e)
{

    if (this.RadDock1.Closed)
        this.RadDock1.Closed = false;
    else
        this.RadDock1.Closed = true;
}

What am I doing wrong here?

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

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

发布评论

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

评论(2

甜尕妞 2024-07-26 00:48:29

更新:您的代码没有做任何错误。 我能够使用 UpdatePanel 和 RadAjaxManager 重复此问题。 据 Telerik 支持人员称,这是 RadDock 控件的“限制”。 在我看来更像是一个错误。

以下是其支持页面论坛中的内容: 克隆的非停靠码头加上无效的 JSON 原语

RadDock 控件不是标准
控制并有一些限制
当它通过ajax更新时。 如果你
想要通过 ajax 更新 RadDock 你
应该更新所有 RadDockZones 和所有
RadDocks 应该对接。

您遇到的错误是由于
您更新浮动 RadDock
使用 AJAX。 当拖动码头时
将其移出更新面板并
这会导致 AJAX 无法正常工作
当它尝试重新创建码头时
它以前所在的地方。
这样两个dock具有相同的id
出现在页面上,这会导致
一个例外。 这是一个常见问题
对于所有可以移动的控件
在 DOM 中。

我能够通过将 RadDock 包装在 RadDockZone 内并将 DockMode 属性设置为“Docked”来使您的代码正常工作。 但是,如果我将扩展坞拖出该区域,使其保持浮动并单击“更新”按钮,则会再次出现错误。

<asp:UpdatePanel ID="upanelDock" runat="server">
    <ContentTemplate>
       <telerik:RadDockZone runat="server">
        <telerik:RadDock ID="RadDock1" runat="server" Width="300px" 
                                                      DockMode="Docked">
            <TitlebarTemplate>
                <h2>
                    this is a dock
                </h2>
            </TitlebarTemplate>
            <ContentTemplate>
                some content here
                <br />
                some content here
                <br />
                some content here
                <br />               
            </ContentTemplate>
        </telerik:RadDock>
      </telerik:RadDockZone>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="lbtnUpdate" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
<asp:LinkButton ID="lbtnUpdate" runat="server"
           OnClick="lbtnUpdate_Click">update</asp:LinkButton>

UPDATE: You are not doing anything wrong in your code. I was able to duplicate this problem using both UpdatePanel and RadAjaxManager. According to Telerik support, this is a "limitation" in the RadDock control. More like a bug in my opinion.

Here's what it says in their Support Page Forum: Non-docked Docks cloned plus Invalid JSON primitive

The RadDock control is not a standard
control and there are some limitations
when it is updated via ajax. If you
want to update a RadDock via ajax you
should update all RadDockZones and all
RadDocks should be docked.

The error you experience is due to
that you update a floating RadDock
with AJAX. When dragging the dock you
move it outside the update panel and
this causes AJAX not working properly
as it attempts to recreate the dock at
the place it was previously located.
In this way two docks with the same id
appear on the page and this leads to
an exception. This is a common problem
for all controls which could be moved
in the DOM.

I was able to make your code work by wrapping the RadDock inside a RadDockZone and setting the DockMode property to "Docked". If however, I drag the dock out of the zone, leave it floating and click the "Update" button, the error reappears.

<asp:UpdatePanel ID="upanelDock" runat="server">
    <ContentTemplate>
       <telerik:RadDockZone runat="server">
        <telerik:RadDock ID="RadDock1" runat="server" Width="300px" 
                                                      DockMode="Docked">
            <TitlebarTemplate>
                <h2>
                    this is a dock
                </h2>
            </TitlebarTemplate>
            <ContentTemplate>
                some content here
                <br />
                some content here
                <br />
                some content here
                <br />               
            </ContentTemplate>
        </telerik:RadDock>
      </telerik:RadDockZone>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="lbtnUpdate" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
<asp:LinkButton ID="lbtnUpdate" runat="server"
           OnClick="lbtnUpdate_Click">update</asp:LinkButton>
岛徒 2024-07-26 00:48:29

我有几个 RadDock 漂浮在 RadDockLayout 内。 如果我更新 RadDock、RadDockLayout 或通过 RadAjaxManager 对象包装 RadDockLayout 的主面板,Ajax 就可以工作。

前任:

<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="mainPanel" />
    </UpdatedControls>
</telerik:AjaxSetting>

I have a couple RadDocks floating inside a RadDockLayout. Ajax works if I update the RadDock, the RadDockLayout, or the main panel that wraps the RadDockLayout through the RadAjaxManager object.

Ex:

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