<asp:FormView ID="FormView1" runat="server" DataSourceID="editcontentDS" DefaultMode="Edit"><EditItemTemplate> <telerik:RadEditor ID="RadEditor1" runat="server" EnableResize="False" Skin="Sunset" Width="950px" Content='<%# Bind("content_detail") %>'> <Tools> <telerik:EditorToolGroup> <telerik:EditorTool Name="Bold" /> <telerik:EditorTool Name="Italic" /> <telerik:EditorTool Name="FindAndReplace" /> <telerik:EditorTool Name="AjaxSpellCheck" /> <telerik:EditorTool Name="ForeColor" /> <telerik:EditorTool Name="Undo" /> <telerik:EditorTool Name="Redo" /> </telerik:EditorToolGroup> </Tools> </telerik:RadEditor> <br /> <asp:Button ID="UpdateButton" runat="server" CausesValidation="false" CommandName="Update" Text="Update" /> <input id="UpdateCancelButton" type="button" value="Cancel" onclick="history.go(-1);return false;" /></EditItemTemplate></asp:FormView><asp:SqlDataSource ID="editcontentDS" runat="server" ConnectionString="<%$ ConnectionStrings:myconnection %>" SelectCommand="SELECT content_detail FROM content_items WHERE pages_id = 1" UpdateCommand="UPDATE content_items SET content_detail=@pageContent WHERE pages_id = 1"> <UpdateParameters> <asp:Parameter Name="pageContent" Type="String" /> </UpdateParameters></asp:SqlDataSource>Protected Sub editcontentDS_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles editcontentDS.Updating Dim updatedContent As String = RadEditor1.ContentEnd SubAny ideas?
10 Answers, 1 is accepted
Do you have designer vb file attached to the codebehind file in your project? If you have a designer file register the editor object in it and try again to access it.
Also check whether you have registered the Telerik.Web.UI namespace in the codebehind page:
Imports Telerik.Web.UI;
Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Imports Telerik.Web.UIImports System.ConfigurationImports System.DataPartial Class admin_editpage Inherits System.Web.UI.Page Protected Sub editcontentsDS_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles editcontentDS.Updating Dim updatedContent As String = Me.RadEditor1.Content e.Command.Parameters("@pageContent".Value = updatedContent End SubEnd ClassCould it be that the FormView I have it nested in is "hiding" it somehow??
Thanks again! Terri-Lynn
Does the problem happen if you type RadEditor1 in the Page_Load server handler?
So far I am unable to reproduce the issue on my side. Here is a video demonstration: http://screencast.com/t/RAmCb0HMh9D3.
For your convenience I have also attached my test project.
Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Yes, the same happens for my page load. As mentioned earlier, I suspect it's the fact that I have the RadEditor inside a FormView? I've included all of my code in this thread already. I need to pull from a db, and post back to it. Pretty simple task, but it's one that's been the cause of me not moving forward with my project. In the Bin folder of my website I have Telerik.Web.UI.dll and Telerik.Web.UI.xml. Also, in my App_Data I have RadSpell. Am I missing something here??
Any further help is greatly appreciated.
Have you had a chance to test the provided project in my earlier post? Does the reference to RadEditor work in it?
Here is an example how to find the editor in a FormView control:
Protected Sub FormView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.DataBound
If FormView1.CurrentMode = FormViewMode.Edit Then
Dim myEditor As RadEditor = (DirectCast(FormView1.FindControl("RadEditor1"), RadEditor))
Dim documents As String() = New String() {"~/Documents"}
myEditor.DocumentManager.ViewPaths = documents
myEditor.DocumentManager.UploadPaths = documents
myEditor.DocumentManager.DeletePaths = documents
End If
End Sub
Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Thanks,
Terri-Lynn
Hi all:
I've figured it out. Instead of using the CommandName=Update, I simply put a button on the page and did it from inside there. I did use some of the code you mention Ramen, so thank-you! Here's my final block of code that works:
Protected Sub UpdateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UpdateButton.Click Dim myEditor As RadEditor = (DirectCast(FormView1.FindControl("RadEditor1"), RadEditor)) Dim updatedContent As String = myEditor.Content editcontentDS.UpdateParameters("pageContent").DefaultValue = updatedContent Try editcontentDS.Update() recordSaved.Visible = True Catch ex As Exception recordSaved.Text = "Update Failed. Please see your web administrator" End TryEnd SubI'm new in using Telerik control and I have similar as you did. After read your post, I did the similar coding in my project but no luck to get it work.
Dim myEditor As RadEditor = (DirectCast(RadPageView1.FindControl("RadEditor1"), RadEditor))
Dim updatedContent As String = myEditor.Content
I got error msg of "Oject reference not set to an instance of an object", do you encounted similar situation before. And would be very appreciate if you have solution.
cheers,
ChiHong.
Unfortunately I've seen that specific error far too many times to count, but I don't recall getting it in this instance. The only advice I can provide is to ensure you've imported the Telerik.Web.UI namespace at the top of your code-behind file. Not sure if it matters, but here are all the items I import:
Imports Telerik.Web.UI
Imports System.Configuration
Imports System.Data
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.IO
Imports System.Collections
Imports System.Data.SqlClient
Only other thing that comes to mind is that you double check that RadPageView1 is the name of your FormView, and RadEditor1 is the name of your RadEditor.
Let me know if this helps at all!
Terri-Lynn
