This is a migrated thread and some comments may be shown as answers.

Save in Database

6 Answers 124 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Adigard
Top achievements
Rank 1
Adigard asked on 03 Nov 2011, 11:57 PM
Greetings,

I have been trying to follow the steps of this demo to save the content of my Editor in my database.
http://demos.telerik.com/aspnet-ajax/editor/examples/saveindatabase/defaultcs.aspx
But it is not working unfortunately

<form id="form1" runat="server">
<div>
<input type="hidden" name="EditedNews" runat="server" id="EditedNews" />
    <telerik:RadEditor ID="NewsEditor" runat="server">
    </telerik:RadEditor>
</div>
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<asp:SqlDataSource ID="SqlDataSourceRadEditor" runat="server"
    ConflictDetection="OverwriteChanges"
    ConnectionString="<%$ ConnectionStrings:IntranetConnectionString %>"
    DeleteCommand="DELETE FROM [rendezvous] WHERE [idRDV] = @idRDV"
    InsertCommand="INSERT INTO [rendezvous] ([rapport]) VALUES (@rapport) WHERE idRDV = @idRDV "
    SelectCommand="SELECT [idRDV], [rapport] FROM [rendezvous]"
    UpdateCommand="UPDATE [rendezvous] SET [rapport] = @rapport WHERE [idRDV] = @idRDV">
    <DeleteParameters>
        <asp:Parameter Name="idRDV" Type="Int32" />
        <asp:Parameter Name="rapport" Type="String" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="rapport" Type="String" />
    </InsertParameters>
    <UpdateParameters>
        <asp:QueryStringParameter Name="idRDV" QueryStringField="idRDV" Type="Int32" />
        <asp:Parameter Name="rapport" Type="String" />
    </UpdateParameters>
</asp:SqlDataSource>
</form>

protected void Button1_Click(object sender, EventArgs e)
{
    if (EditedNews.Value == string.Empty)
    {
       
        SqlDataSourceRadEditor.UpdateParameters.Add("NewsText", NewsEditor.Content);
        SqlDataSourceRadEditor.Update();
    }
 
     
}


PS: the RadEditor control is within a RadWindow and i pass an ID from a RadGrid to the window, that's why i have a
<asp:QueryStringParameter Name="idRDV" QueryStringField="idRDV" Type="Int32" />

To get back the ID.
The Command i try to do is the update.

Thanks in advance for your help

6 Answers, 1 is accepted

Sort by
0
Adigard
Top achievements
Rank 1
answered on 07 Nov 2011, 09:33 AM
Nobody knows ?
0
Marin Bratanov
Telerik team
answered on 08 Nov 2011, 01:45 PM
Hi Adigard,

How you update the database is not related to the RadEditor. The reason why it is not working should be found in your database, as the RadEditor is very similar to a regular TextBox for this scenario - you obtain its content as an HTML string and what you do with it and how you store it in the database is up to the developer.


Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Adigard
Top achievements
Rank 1
answered on 08 Nov 2011, 02:28 PM
First of all , thank you for your help

But i'm not sure to really understand where the problem comes from ...

According to you , the problem might come from my table itself ?
Nothing to add in the code i have posted above ?

thank you in advance
0
Accepted
Rumen
Telerik team
answered on 08 Nov 2011, 02:58 PM
Hello Adigard,

You can think of RadEditor as an advanced Asp:TextBox control. The only difference is that instead of using the Text property to get / set the content, you should use the Content property of RadEditor, which returns or set the HTML content. The Text property of RadEditor returns plain text only and is read only.

If it will be easier for you, implement your scenario with a regular Asp:TextBox instead of using RadEditor. Once you are ready and if you face any problems replacing the textbox with radeditor, just send us a sample working project with the solution and we will do the replacement for you.

Greetings,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Adigard
Top achievements
Rank 1
answered on 08 Nov 2011, 03:37 PM
I managed to make it work perfectly!
thank you!
0
Adigard
Top achievements
Rank 1
answered on 08 Nov 2011, 04:17 PM
... resolved
Tags
Editor
Asked by
Adigard
Top achievements
Rank 1
Answers by
Adigard
Top achievements
Rank 1
Marin Bratanov
Telerik team
Rumen
Telerik team
Share this question
or