I am trying to use the FCKEditor in an ASP.Net 2.0 DetailsView control. When I click the Edit button on the DetailsView control, FCKEditor appears no problem, with the bound field's text as I would expect. But when I change the text in it, and click Update, the text doesn't update in the database. When the control was just a textbox for the edit portion of the DetailsView, it always updated the database. Here is some markup:
<asp:TemplateField HeaderText="Details" SortExpression="FullDescription">
<EditItemTemplate>
<FCKeditorV2:FCKeditor Width="600" Height="400" ID="FCKeditor1" runat="server" BasePath="~/FCKeditor/" Value='<%# Bind("FullDescription") %>'></FCKeditorV2:FCKeditor>
</EditItemTemplate>
<ItemStyle Width="300px" /><ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("FullDescription") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Details" SortExpression="FullDescription">
<EditItemTemplate>
<FCKeditorV2:FCKeditor Width="600" Height="400" ID="FCKeditor1" runat="server" BasePath="~/FCKeditor/" Value='<%# Bind("FullDescription") %>'></FCKeditorV2:FCKeditor>
</EditItemTemplate>
<ItemStyle Width="300px" /><ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("FullDescription") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
RE: Use FCKEditor in DetailsView in edit mode
Here is how I tested this: The DetailsView control is populated with a record from Sql Server. I used a template field containing FCKEditor in the DetailsView control's edit mode, so that I could have the editor instead of the default textbox that Asp.Net uses.
I created a variable in the ItemUpdating event of the DetailsView control, and captured the editor's value before it goes to the database.
When I edit the text inside the editor, and then click the Update button on the DetailsView control, the text in the editor's Value property doesn't show my changes. However, if I first press the Save button on the editor, then the Value property shows my changes.
This seems redundant. If I'm using the control with a DetailsView, and the controls within the DetailsView are bound to database fields, why is their a need to click Save on the editor in addition to the Update button on the DetailsView? Is there a way to bypass the Save button?
RE: Use FCKEditor in DetailsView in edit mode
RE: Use FCKEditor in DetailsView in edit mode
I had the same problem, I solved adding an hidden textbox bound to the sql field and on ItemUpdating Event I do this:
Protected Sub FormView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewUpdateEventArgs) Handles FormView1.ItemUpdating
Dim fcTitle As FCKeditorV2.FCKeditor
Dim mpContentPlaceHolder As FormView
e.Cancel = False
mpContentPlaceHolder = _
CType(Master.FindControl("ContentPlaceHolder2").FindControl("FormView1"), _
FormView)
If Not mpContentPlaceHolder Is Nothing Then
fcTitle = CType(mpContentPlaceHolder. _
FindControl("FCKeditorContenuto"), FCKeditorV2.FCKeditor)
If Not (fcTitle Is Nothing) Then
e.NewValues.Item("Contenuto") = fcTitle.Value()
End If
End If
End Sub
In this way there is no need to click on Save Button on the editor window.
I hope this help you.
RE: Use FCKEditor in DetailsView in edit mode
Richard
RE: Use FCKEditor in DetailsView in edit mode