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

RadEditor not recognized by intellisense

10 Answers 130 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Terri-Lynn
Top achievements
Rank 1
Terri-Lynn asked on 03 Jun 2011, 11:06 PM
I have a RadEditor nested inside a FormView so that I can bind database data inside.  This is working nicely.  In trying to save the content of the RadEditor back to the database, however, my CodeFile isn't recognizing my RadEditor.  Here's my .aspx:
<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>
Then there's my SqlDataSourse:
<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>
And lastly my lonely CodeFile:
Protected Sub editcontentDS_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles editcontentDS.Updating
    Dim updatedContent As String = RadEditor1.Content
 
End Sub
RadEditor1 has the following error: 'RadEditor1' is not declared. It may be inaccessible due to its protection level.

Any ideas?

10 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 08 Jun 2011, 02:18 PM
Hi Terri-Lynn,

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.

0
Terri-Lynn
Top achievements
Rank 1
answered on 09 Jun 2011, 03:17 PM
Hi Rumen.  Thanks for you reply.  No, I do not have any designer files.  Below is my entire .aspx.vb file:
Imports Telerik.Web.UI
Imports System.Configuration
Imports System.Data
 
Partial 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 Sub
 
End Class
The Me.RadEditor1 has a red squiggly line under it with the error: 'RadEditor1' is not a member of 'admin_editpage'

Could it be that the FormView I have it nested in is "hiding" it somehow??

Thanks again!  Terri-Lynn
0
Rumen
Telerik team
answered on 13 Jun 2011, 01:24 PM
Hi 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.

0
Terri-Lynn
Top achievements
Rank 1
answered on 13 Jun 2011, 03:27 PM
Hi Rumen:

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.
0
Rumen
Telerik team
answered on 16 Jun 2011, 08:46 AM
Hi Terri-Lynn,

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.

0
Terri-Lynn
Top achievements
Rank 1
answered on 16 Jun 2011, 03:36 PM
Thanks again Rumen for your reply.  Yes I did use your example, and yes it worked.  I'm having fundamental issues figuring out how to use this tool as I need it to.  I've followed the "Getting Started", and that was simple, but now I have it databound, and the example you give above doesn't help me with my issue.  I need to save the contents back to the database.  I'll keep chipping away at it, and if you have any further direction that would be greatly appreciated.

Thanks,
Terri-Lynn
0
Terri-Lynn
Top achievements
Rank 1
answered on 16 Jun 2011, 04:41 PM

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 Try
End Sub
0
Chi Hong
Top achievements
Rank 1
answered on 18 Nov 2011, 10:55 AM
Hello Terri-Lynn,

I'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.


0
Terri-Lynn
Top achievements
Rank 1
answered on 18 Nov 2011, 04:37 PM
Hi 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
0
Abhishek
Top achievements
Rank 1
answered on 11 Oct 2012, 11:24 AM
nice coding
Tags
Editor
Asked by
Terri-Lynn
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Terri-Lynn
Top achievements
Rank 1
Chi Hong
Top achievements
Rank 1
Abhishek
Top achievements
Rank 1
Share this question
or