我有AjaxControlToolkit的最新版本,并且在AjaxControlToolkit ReorderList中使用了AjaxControlToolkit Html Editor控件。我需要能够访问“content”属性,以便我可以将值写入数据库,但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
答案 0 :(得分:0)
之前我没有使用过AjaxControlToolKit ReorderList控件,但您可能需要访问类似“_OnItemDataBound”事件的内容。当一行被数据绑定并且您无法按照您的想法访问它们时,有时控件会被推到那里。
祝你好运,希望这有助于一些人。
答案 1 :(得分:0)
以下是您的解决方案:
在此示例中,它将内容从aspx页面转移到ascx页面
AjaxControlToolkit.HTMLEditor.Editor txtNotes = (AjaxControlToolkit.HTMLEditor.Editor)Page.FindControl("txtNotes");
txtView.Content = txtNotes.Content;