Clive Hoggar
Top achievements
Rank 1
Clive Hoggar
asked on 25 Nov 2009, 03:43 PM
Hi
I am using the editor in the popup edit mode of a grid, which itself is using Default skin.
Thus the background color of the Editor box in Design mode is grey.
How can I overule this default bg and make it white?
Thanks
Clive
I am using the editor in the popup edit mode of a grid, which itself is using Default skin.
Thus the background color of the Editor box in Design mode is grey.
How can I overule this default bg and make it white?
Thanks
Clive
3 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 26 Nov 2009, 05:55 AM
Hello Clive,
You can access the Editor control in the Edit Popup and set the BackColor from code as shown below.
ASPX:
CS:
Thanks,
Princy.
You can access the Editor control in the Edit Popup and set the BackColor from code as shown below.
ASPX:
<Columns> |
<telerik:GridHTMLEditorColumn UniqueName="Editor1" DataField="Address" HeaderText="Address" > |
</telerik:GridHTMLEditorColumn> |
. . . |
CS:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) |
{ |
if (e.Item is GridEditFormItem & e.Item.IsInEditMode) |
{ |
GridEditFormItem editItem = (GridEditFormItem)e.Item; |
RadEditor editor = (RadEditor)editItem["Editor1"].Controls[0]; |
editor.BackColor = System.Drawing.Color.White; |
} |
} |
Thanks,
Princy.
0
Clive Hoggar
Top achievements
Rank 1
answered on 26 Nov 2009, 11:18 AM
HI
Thanks Prinzy
I have converted this to vb with the Telerik converter, but I am getting runtime error:
System.InvalidCastException: Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'Telerik.Web.UI.RadEditor'.
System.InvalidCastException: Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'Telerik.Web.UI.RadEditor'.
Maybe the vb code is not just right? Can you see what is wrong? I tried 'FindControl' instead but that did not do anything.
The actual code is below:
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound |
If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then |
If e.Item.OwnerTableView.IsItemInserted Then |
'item is about to be inserted |
Dim item As GridEditableItem = DirectCast(e.Item, GridEditableItem) |
Dim TxtBx As TextBox = DirectCast(item.FindControl("TTLTextBox"), TextBox) |
TxtBx.Text = "21" |
If TypeOf e.Item Is GridEditFormItem And e.Item.IsInEditMode Then |
Dim editItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem) |
Dim editor As RadEditor = DirectCast(editItem("BodyHtml").Controls(0), RadEditor) |
editor.BackColor = System.Drawing.Color.White |
End If |
Else |
'item is about to be edited |
End If |
End If |
End Sub |
<telerik:GridTemplateColumn DataField="BodyHtml" HeaderText="Email Body" |
SortExpression="BodyHtml" UniqueName="BodyHtml" |
Visible="False"> |
<EditItemTemplate> |
<telerik:RadEditor ID="RadEditor1" runat="server" Content='<%# Bind("BodyHtml") %>' |
Width="850px" Height="500px"> |
</telerik:RadEditor> |
</EditItemTemplate> |
<ItemTemplate> |
<asp:Label ID="BodyHtmlLabel" runat="server" Text='<%# Eval("BodyHtml") %>'></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
Thanks for your help
Clive
0
Hi Clive,
The BackColor of RadEditor is inherited from the base control and it is not implemented to work. To fix the problem you should set the CssFiles property as shown below:
You can find more information in this article: Setting Editor Background And Color.
Best regards,
Rumen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
The BackColor of RadEditor is inherited from the base control and it is not implemented to work. To fix the problem you should set the CssFiles property as shown below:
<
telerik:radeditor
runat
=
"server"
ID
=
"RadEditor1"
>
<
CssFiles
>
<
telerik:EditorCssFile
Value
=
"~/EditorContentArea.css"
/>
</
CssFiles
>
</
telerik:radeditor
>
You can find more information in this article: Setting Editor Background And Color.
Best regards,
Rumen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.