I have a RADGrid named 'RadGrid1' in my ASPX page.
RadGrid1 has Form Template Edit form and this edit form contains RADEditor named 'RadEditor1'.
If I want to get the content of the RADEditor 'RadEditor1' in the code behind file of this ASPX page, what is the correct way of referencing the contents in the RadEditor1?
I tried the code shown below:
But I get the error 'System.EventArgs' does not contain a definition for 'Item' and no extension method 'Item' accepting...'
I have also tried the code shown below to get the content stored in the RadEditor1 but it still didn't work.
Thank you.
RadGrid1 has Form Template Edit form and this edit form contains RADEditor named 'RadEditor1'.
If I want to get the content of the RADEditor 'RadEditor1' in the code behind file of this ASPX page, what is the correct way of referencing the contents in the RadEditor1?
I tried the code shown below:
RadEditor radEditor = ((RadEditor)e.Item.FindControl(
"RadEditor1"
));
string
content = radEditor.Content;
But I get the error 'System.EventArgs' does not contain a definition for 'Item' and no extension method 'Item' accepting...'
I have also tried the code shown below to get the content stored in the RadEditor1 but it still didn't work.
string
content = RadGrid1.RadEditor1.Content;
Thank you.
5 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 16 Aug 2012, 10:07 AM
Hi,
Try accessing the RadEditor in the ItemDataBound event, since the RadEditor is inside the FormTemplate.
C#:
Thanks,
Princy.
Try accessing the RadEditor in the ItemDataBound event, since the RadEditor is inside the FormTemplate.
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridEditFormItem && e.Item.IsInEditMode)
{
RadEditor radEditor = ((RadEditor)e.Item.FindControl(
"RadEditor1"
));
string
content = radEditor.Content;
}
}
Thanks,
Princy.
0
ILJIMAE
Top achievements
Rank 1
answered on 17 Aug 2012, 12:29 AM
I have a button in the Form Template with ID 'ButtonA'.
Is it possible to get the content of the radeditor 'RADEditor1' when the user press the button?
Thank you,
<
asp:Button
ID
=
"ButtonA"
Text
=
"Get Content"
runat
=
"server"
CausesValidation
=
"False"
onClick
=
"ButtonAPressed"
></
asp:Button
>
Is it possible to get the content of the radeditor 'RADEditor1' when the user press the button?
protected
void
ButtonAPressed(
object
source, EventArgs e)
{
// How can I get the content of the RADEditor1?
}
Thank you,
0
Accepted
Princy
Top achievements
Rank 2
answered on 17 Aug 2012, 04:23 AM
Hi,
Here is the code snippet to get the RadEditor content on Button Click.
C#:
Thanks,
Princy.
Here is the code snippet to get the RadEditor content on Button Click.
C#:
protected
void
ButtonA_Click(
object
sender, EventArgs e)
{
Button GetContent = (Button)sender;
GridEditFormItem item = (GridEditFormItem)GetContent.NamingContainer;
RadEditor radEditor = ((RadEditor)item.FindControl(
"RadEditor1"
));
string
content = radEditor.Content;
}
Thanks,
Princy.
0
ILJIMAE
Top achievements
Rank 1
answered on 17 Aug 2012, 06:29 AM
Thank you so much for your help, Princy.
ALL worked fine.
Thank you.
ALL worked fine.
Thank you.
0
Soismel
Top achievements
Rank 1
answered on 01 Jul 2014, 05:10 PM
Hello,
I'm new using Telerik and I'm trying to get the RadEditor content in a RadGrid and is always empty.
I tried many things and doesn't work.
Can anyone help me?[quote]Your quote goes here[/quote]
Thanks!
My code is simple:
My code is simple:
User Control:
Code Behind (c#):
I'm new using Telerik and I'm trying to get the RadEditor content in a RadGrid and is always empty.
I tried many things and doesn't work.
Can anyone help me?[quote]Your quote goes here[/quote]
Thanks!
My code is simple:
My code is simple:
User Control:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="New_Meeting_u.ascx.cs" Inherits="FHPACS.Modules.PACS_Manager.Meetings.New_Manager_Meeting_u" %>
<
asp:UpdatePanel
ID
=
"UpdPanelStudies"
runat
=
"server"
>
<
ContentTemplate
>
<
telerik:RadAjaxPanel
runat
=
"server"
ID
=
"RadAjaxPanel"
LoadingPanelID
=
"LoadingPanel1"
Width
=
"100%"
>
<
telerik:RadGrid
ID
=
"dgrTeamMembers"
runat
=
"server"
GridLines
=
"None"
AllowFilteringByColumn
=
"false"
allo
AllowSorting
=
"false"
ShowGroupPanel
=
"false"
OnGroupsChanging
=
"dgrTeamMembers_GroupsChanging"
OnLoad
=
"dgrTeamMembers_Load"
>
<
MasterTableView
AutoGenerateColumns
=
"false"
DataKeyNames
=
"OPID"
EnableHeaderContextMenu
=
"false"
>
<
Columns
>
<
telerik:GridTemplateColumn
HeaderText
=
""
UniqueName
=
"Assist"
AllowFiltering
=
"false"
HeaderStyle-Width
=
"30px"
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"cbxAssist"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"ID"
DefaultInsertValue
=
""
HeaderText
=
"ID"
ReadOnly
=
"true"
SortExpression
=
"ID"
UniqueName
=
"ID"
HeaderStyle-Width
=
"70px"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FIRST_NAME"
DefaultInsertValue
=
""
HeaderText
=
"FIRST NAME"
ReadOnly
=
"true"
SortExpression
=
"FIRST_NAME"
UniqueName
=
"FIRST_NAME"
HeaderStyle-Width
=
"90px"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"LAST_NAME"
DefaultInsertValue
=
""
HeaderText
=
"LAST NAME"
ReadOnly
=
"true"
SortExpression
=
"LAST_NAME"
UniqueName
=
"LAST_NAME"
HeaderStyle-Width
=
"120px"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"COMMENTS"
UniqueName
=
"COMMENTS"
AllowFiltering
=
"false"
HeaderStyle-Width
=
"100%"
ItemStyle-Height
=
"120px"
>
<
ItemTemplate
>
<
telerik:RadEditor
ID
=
"edtComment"
runat
=
"server"
MaxTextLength
=
"700"
Width
=
"577px"
Height
=
"120px"
EditModes
=
"Design"
EnableTextareaMode
=
"True"
>
<
Languages
>
<
telerik:SpellCheckerLanguage
Code
=
"en-US"
Title
=
"English"
/>
</
Languages
>
<
Tools
>
<
telerik:EditorToolGroup
>
<
telerik:EditorTool
Name
=
"Bold"
/>
<
telerik:EditorTool
Name
=
"Italic"
/>
<
telerik:EditorTool
Name
=
"Underline"
/>
<
telerik:EditorSeparator
/>
<
telerik:EditorTool
Name
=
"JustifyLeft"
/>
<
telerik:EditorTool
Name
=
"JustifyCenter"
/>
<
telerik:EditorTool
Name
=
"JustifyRight"
/>
<
telerik:EditorTool
Name
=
"JustifyFull"
/>
<
telerik:EditorTool
Name
=
"JustifyNone"
/>
<
telerik:EditorTool
Name
=
"InsertTable"
/>
<
telerik:EditorSeparator
/>
<
telerik:EditorTool
Name
=
"Undo"
/>
<
telerik:EditorTool
Name
=
"Redo"
/>
<
telerik:EditorTool
Name
=
"ForeColor"
/>
<
telerik:EditorSeparator
/>
<
telerik:EditorTool
Name
=
"InsertTime"
/>
<
telerik:EditorTool
Name
=
"InsertDate"
/>
<
telerik:EditorSeparator
/>
<
telerik:EditorTool
Name
=
"FontName"
/>
<
telerik:EditorTool
Name
=
"RealFontSize"
/>
</
telerik:EditorToolGroup
>
</
Tools
>
</
telerik:RadEditor
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
AllowDragToGroup
=
"false"
AllowColumnsReorder
=
"true"
Selecting-AllowRowSelect
=
"true"
>
<
Resizing
AllowColumnResize
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
</
telerik:RadAjaxPanel
>
<
br
/>
<
br
/>
<
asp:Button
ID
=
"btnSaveMeeting"
runat
=
"server"
Text
=
"Save Meeting"
OnClick
=
"btnSaveMeeting_Click"
/>
</
ContentTemplate
>
</
asp:UpdatePanel
>
Code Behind (c#):
using
System;
using
System.IO;
using
System.Web;
using
System.Linq;
using
System.Web.UI;
using
Telerik.Web.UI;
using
System.Drawing;
using
System.Configuration;
using
System.Web.UI.WebControls;
using
System.Collections.Generic;
using
Telerik.Web.UI.GridExcelBuilder;
public
partial
class
New_Meeting_u : System.Web.UI.UserControl
{
protected
void
btnSaveMeeting_Click(
object
sender, EventArgs e)
{
string
commet =
""
;
for
(
int
i = 0; i < dgrTeamMembers.Items.Count; i++)
{
CheckBox cbxonmeeting = dgrTeamMembers.Items[i].FindControl(
"cbxAssist"
)
as
CheckBox;
if
(cbxonmeeting.Checked)
{
comment = ((RadEditor)dgrTeamMembers.Items[i].Cells[6].Controls[1]).Content;
}
}
}
}