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

Unreliable UPDATE using SqlDataSource

1 Answer 67 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 16 Mar 2009, 12:53 AM
I had it working and now it has stopped. I can't figure out what I've done wrong!

I created my SqlDataSource (one of several on the page) and tested it. I have since fiddled with the UpdateParameters, converting them to FormParameters and giving them a type of "String" instead of the default "Object" in case that mattered.

        <asp:SqlDataSource ID="ExistingDataSqlDataSource"  
            runat="server"  
            ConnectionString="<%$ ConnectionStrings:IepWizardDBConnectionString %>"  
            SelectCommand="SELECT ClassroomAssessmentText, TeacherObservationText, ParentInformationText, OtherEvaluationData FROM EvaluationReviews WHERE (EvaluationReviewID = @EvaluationReviewID)"  
            UpdateCommand="UPDATE EvaluationReviews SET ClassroomAssessmentText = @ClassroomAssessmentText, TeacherObservationText = @TeacherObservationText, ParentInformationText = @ParentInformationText, OtherEvaluationData = @OtherEvaluationData WHERE (EvaluationReviewID = @EvaluationReviewID)"
            <SelectParameters> 
                <asp:SessionParameter  
                    DefaultValue="2"  
                    Name="EvaluationReviewID"  
                    SessionField="EvaluationReviewID" /> 
            </SelectParameters> 
            <UpdateParameters> 
                <asp:FormParameter DbType="String" Name="ClassroomAssessmentText" /> 
                <asp:FormParameter DbType="String" Name="TeacherObservationText" /> 
                <asp:FormParameter DbType="String" Name="ParentInformationText" /> 
                <asp:FormParameter DbType="String" Name="OtherEvaluationData" /> 
                <asp:SessionParameter  
                    DbType="Int32"  
                    DefaultValue="2"  
                    Name="EvaluationReviewID"  
                    SessionField="EvaluationReviewID" /> 
            </UpdateParameters> 
        </asp:SqlDataSource> 

I dropped a FormView onto the page (actually into a RadMultiPage in case that matters). Deleted the textboxes and replaced them with RadEditors, "Edit Databindings", "refresh schema" in the binding editor, bound "Content" to the parameter I required.

It worked for a while. I took a break in triumph, came back, and I must have changed something because I can't get it to work anymore.

Here is the code for the RadEditor itself:
                <telerik:RadEditor  
                    ID="RadEditor1"  
                    Runat="server"  
                    Content='<%# Bind("ClassroomAssessmentText") %>'  
                    Skin="Web20"  
                    EditModes="Design"
                    <Content></Content
                    <CssFiles> 
                        <telerik:EditorCssFile Value="../styles/EditorContentArea.css" /> 
                    </CssFiles> 
                    <Tools> 
                        <telerik:EditorToolGroup > 
                            <telerik:EditorTool Name="Cut" /> 
                            <telerik:EditorTool Name="Copy" /> 
                            <telerik:EditorTool Name="Paste" /> 
                            <telerik:EditorTool Name="PasteFromWord" /> 
                            <telerik:EditorTool Name="Bold" /> 
                            <telerik:EditorTool Name="Italic" /> 
                            <telerik:EditorTool Name="Underline" /> 
                            <telerik:EditorTool Name="StrikeThrough" /> 
                            <telerik:EditorTool Name="InsertUnorderedList" /> 
                            <telerik:EditorTool Name="Indent" /> 
                            <telerik:EditorTool Name="Outdent" /> 
                            <telerik:EditorTool Name="Undo" /> 
                            <telerik:EditorTool Name="Redo" /> 
                            <telerik:EditorTool name="FindAndReplace" shortcut="CTRL+F"/> 
                            <telerik:EditorTool Name="InsertDate" /> 
                        </telerik:EditorToolGroup> 
                    </Tools> 
               </telerik:RadEditor> 


Can you tell me how to code this so it just works every time? I don't need drag-and-drop, I just need a solution that works reliably.

What should the databind look like on the RadEditor?
What should the UpdateParameters (or the whole SqlDataProvider) look like?
Is there an alternative to using the FormView that I can just wire up myself?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 19 Mar 2009, 11:44 AM
Hi Scott,

The only problem that I saw in your code is the inner <Content></Content> tags inside the RadEditor's declaration. Please, remove them because they can reset the content inside the editor.

You can also see the code of the following similar example: Datagrid Edit Template.

Best regards,
Rumen
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Editor
Asked by
Scott
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or