当 AjaxControlToolkit Html 编辑器控件位于 AjaxControlToolkit ReorderList 内时,为什么我无法使用 FindControl 找到它?

发布于 2024-08-11 04:39:24 字数 1132 浏览 4 评论 0原文

我有最新版本的 AjaxControlToolkit,并且正在 AjaxControlToolkit ReorderList 中使用 AjaxControlToolkit Html Editor 控件。我需要能够访问“内容”属性,以便我可以将值写入数据库,但 FindControl 找不到它。

例如,我可以在 ItemCommandEvent 中找到一个 TextBox 控件

Protected Sub IncludedSectionComponentsReorderList_ItemCommand(ByVal sender As Object, ByVal e As AjaxControlToolkit.ReorderListCommandEventArgs) Handles IncludedSectionComponentsReorderList.ItemCommand

 If e.CommandName = "SaveChanges" Then

        Dim txtSectionComponentLabel As TextBox = CType(e.Item.FindControl("txtSectionComponentLabel"), TextBox)

 End If End Sub

但我在同一事件中找不到 AjaxControlToolkit Html 编辑器:

Protected Sub IncludedSectionComponentsReorderList_ItemCommand(ByVal sender As Object, ByVal e As AjaxControlToolkit.ReorderListCommandEventArgs) Handles IncludedSectionComponentsReorderList.ItemCommand

    If e.CommandName = "SaveChanges" Then

         Dim editor As Editor = CType(e.Item.FindControl("3Editor"), Editor)
                strSectionControlValue = editor.Content

    End If

End Sub

I have the latest release of the AjaxControlToolkit, and am using an AjaxControlToolkit Html Editor control inside an AjaxControlToolkit ReorderList. I need to be able to access the "content" property so I can write the value to the database but FindControl doesn't find it.

for instance, I can find a TextBox control inside the ItemCommandEvent:

Protected Sub IncludedSectionComponentsReorderList_ItemCommand(ByVal sender As Object, ByVal e As AjaxControlToolkit.ReorderListCommandEventArgs) Handles IncludedSectionComponentsReorderList.ItemCommand

 If e.CommandName = "SaveChanges" Then

        Dim txtSectionComponentLabel As TextBox = CType(e.Item.FindControl("txtSectionComponentLabel"), TextBox)

 End If End Sub

But I can't find an AjaxControlToolkit Html Editor in the same event:

Protected Sub IncludedSectionComponentsReorderList_ItemCommand(ByVal sender As Object, ByVal e As AjaxControlToolkit.ReorderListCommandEventArgs) Handles IncludedSectionComponentsReorderList.ItemCommand

    If e.CommandName = "SaveChanges" Then

         Dim editor As Editor = CType(e.Item.FindControl("3Editor"), Editor)
                strSectionControlValue = editor.Content

    End If

End Sub

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

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

发布评论

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

评论(2

我的影子我的梦 2024-08-18 04:39:24

我以前没有使用过 AjaxControlToolKit ReorderList 控件,但您可能需要访问诸如“_OnItemDataBound”事件之类的内容。有时,当对行进行数据绑定时,控件会被推入其中,并且您无法像您想象的那样访问它们。

祝你好运,希望这对一些人有帮助。

I haven't used the AjaxControlToolKit ReorderList control before, but you may need to access something like the "_OnItemDataBound" event. Sometimes controls are shoved in there when a row is being databound and you can't access them as you would think.

Good luck and hope this helps some.

瑾兮 2024-08-18 04:39:24

这是一个适合您的解决方案:

在此示例中,它将内容从 aspx 页面转移到 ascx 页面

    AjaxControlToolkit.HTMLEditor.Editor txtNotes = (AjaxControlToolkit.HTMLEditor.Editor)Page.FindControl("txtNotes");
    txtView.Content = txtNotes.Content;

Here's a solution for you:

In this example it's taking content from an aspx page to an ascx page

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