当 AjaxControlToolkit Html 编辑器控件位于 AjaxControlToolkit ReorderList 内时,为什么我无法使用 FindControl 找到它?
我有最新版本的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以前没有使用过 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.
这是一个适合您的解决方案:
在此示例中,它将内容从 aspx 页面转移到 ascx 页面
Here's a solution for you:
In this example it's taking content from an aspx page to an ascx page