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

[Solved] Editor content in Grid

7 Answers 193 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Daniel asked on 01 May 2009, 12:22 AM
Hi. I've placed a RadEditor inside a RadGrid EditFormSettings FormTemplate. The editor shows up fine but I can't set the content. I've looked at the following article but it comes back with an error 500 Internal Error. And intellisense doesn't recognise 'Content' anyway.

http://www.telerik.com/support/kb/aspnet-ajax/grid/using-radeditor-as-editor-in-template-column-of-radgrid.aspx

Also trying to bind it in the <Content></Content> tags returns an error that it doesn't allow child objects. Thanks.

Daniel

7 Answers, 1 is accepted

Sort by
0
WebDevIce9
Top achievements
Rank 1
answered on 01 May 2009, 06:49 PM
I have the same issue. The editor updates data just fine, but no content is pulled back on edit. It is just always blank, whether there is data for the field or not.
0
WebDevIce9
Top achievements
Rank 1
answered on 01 May 2009, 06:55 PM
I think I figured this out. This techique is working for me:
Text='<%# Bind( "LongBio") %>' HTML='<%# Eval( "LongBio") %>'


Looks like it wants the HTML property to be set also to view the existing values. Cool.
0
Rumen
Telerik team
answered on 04 May 2009, 10:21 AM
Hi guys,

I just want to clarify that RadEditor for ASP.NET AJAX offers a property named Content for setting / getting the content. To set it, you should use the following syntax:

<telerik:radeditor
       Id="Editor" 
       Runat="server" 
       Content='<%# DataBinder.Eval(Container.DataItem, "NewsText") %>'
 ></telerik:radeditor>



Kind 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.
0
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
answered on 05 May 2009, 02:16 AM
Hi Rumen. This may have worked in previous versions of RadEditor but not the Q1 2009 version. As soon as you type it into the editor, this comes up:

 Message 1 Validation (ASP.Net): Attribute 'Content' is not a valid attribute of element 'RadEditor'. C:\Documents and Settings\danielb\Local Settings\Temp\VWDWebCache\ha-dev01\news\Default.aspx 70 98 http://ha-dev01/

Daniel
0
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
answered on 05 May 2009, 02:22 AM
Thanks for the reply Paul. Unfortunately it didn't work for me. Both come back with something similar to this:

Error 1 The 'Html' property cannot be set declaratively. C:\Documents and Settings\danielb\Local Settings\Temp\VWDWebCache\ha-dev01\news\Default.aspx 69 

--- and ---

Message 2 Validation (ASP.Net): Attribute 'HTML' is not a valid attribute of element 'RadEditor'. C:\Documents and Settings\danielb\Local Settings\Temp\VWDWebCache\ha-dev01\news\Default.aspx 70 98 http://ha-dev01/

Daniel
0
WebDevIce9
Top achievements
Rank 1
answered on 05 May 2009, 04:43 PM
Daniel, you use the HTML property to show the value. You then save the value using code behind. I know, it should all work using the bound controls etc...It just doesn't for me. You have to use a mostly bound/auto save approach for everything else and then write a little code to save the contents of the editor. Here is my code.

Get the value from the database is all done w/out code behind using the EVAL tag.
<td><rad:RadEditor ID="txtLongBio" Runat="server" DocumentsFilters="*.*" HTML='<%# Eval( "LongBio") %>' TabIndex="5"  
    ImagesFilters="*.gif,*.xbm,*.xpm,*.png,*.ief,*.jpg,*.jpe,*.jpeg,*.tiff,*.tif,*.rgb,*.g3f,*.xwd,*.pict,*.ppm,*.pgm,*.pbm,*.pnm,*.bmp,*.ras,*.pcd,*.cgm,*.mil,*.cal,*.fif,*.dsf,*.cmx,*.wi,*.dwg,*.dxf,*.svf"  
    MediaFilters="*.asf,*.asx,*.wm,*.wmx,*.wmp,*.wma,*.wax,*.wmv,*.wvx,*.avi,*.wav,*.mpeg,*.mpg,*.mpe,*.mov,*.m1v,*.mp2,*.mpv2,*.mp2v,*.mpa,*.mp3,*.m3u,*.mid,*.midi,*.rm,*.rma,*.rmi,*.rmv,*.aif,*.aifc,*.aiff,*.au,*.snd"  
    Skin="Custom" TemplateFilters="*.html,*.htm"
    toolsfile="~/RadControls/Editor/BasicToolsFile.xml"
    showhtmlmode="false"
    showpreviewmode="false" ShowSubmitCancelButtons="False"
    Width="650px" Height="300px"
    SaveAsXhtml="False">
</rad:RadEditor>

 

Save the contents using the RadGrid1_ItemUpdated event.

    Protected Sub RadGrid1_ItemUpdated(ByVal source As Object, ByVal e As Telerik.WebControls.GridUpdatedEventArgs) Handles RadGrid1.ItemUpdated 
        Dim radEditor As RadEditor = (DirectCast(e.Item.FindControl("txtLongBio"), RadEditor)) 
        Dim Terr As String = (DirectCast(e.Item.FindControl("txtTerr"), TextBox)).Text 
 
        Dim ParameterArray() As System.Data.SqlClient.SqlParameter = New System.Data.SqlClient.SqlParameter(11) {} 
        Dim x As Integer = 0 
        Dim DAL As New Allergan.Library.Dal 
        Using connection As New System.Data.SqlClient.SqlConnection(DBConnectionString) 
            connection.Open() 
            ReDim ParameterArray(2) 
            ParameterArray(0) = New SqlParameter("@CRUD", "U") 
            ParameterArray(1) = New SqlParameter("@Terr", Terr) 
            ParameterArray(2) = New SqlParameter("@LongBio", radEditor.Html) 
            Dim StoredProcedureName As String = "CRUD_RBM" 
            Dim filler As Integer = Allergan.Library.Dal.ExecuteScalar(connection, CommandType.StoredProcedure, StoredProcedureName, ParameterArray) 
        End Using 
 
        If Not e.Exception Is Nothing Then 
            e.KeepInEditMode = True 
            e.ExceptionHandled = True 
            DisplayMessage(True, PrimaryKeyFieldName + " " + e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)(PrimaryKeyFieldName).ToString() + " cannot be updated. Reason: " + e.Exception.Message) 
        Else 
            DisplayMessage(False, PrimaryKeyFieldName + " " + e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)(PrimaryKeyFieldName).ToString() + " updated") 
            Session("maintperformed") = "true" 
        End If 
    End Sub 
 

0
WebDevIce9
Top achievements
Rank 1
answered on 05 May 2009, 04:46 PM
Here is the sample I used to get'r done.
http://www.telerik.com/help/aspnet-ajax/edittemplateingrid.html


Tags
Editor
Asked by
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
WebDevIce9
Top achievements
Rank 1
Rumen
Telerik team
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or