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

[Solved] Accessing a RadEditor inside a FormTemplate

1 Answer 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suresh Mishra
Top achievements
Rank 1
Suresh Mishra asked on 01 Sep 2009, 08:43 PM
Hi,
I am trying to access a RadEditor inside a FormTemplate.  when I examine the content property of the RadEditor, it is spaces.  Please let me know what I am doing wrong.

Thanks!

Suresh

vb Code Behind:

 

Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs)

 

 

Dim s As String

 

s =

""

 

 

For Each item As GridEditableItem In RadGridEmpData.MasterTableView.GetItems(GridItemType.EditFormItem)

 

 

If item.IsInEditMode Then

 

 

Dim objRadEditor As RadEditor

 

objRadEditor =

CType(item.FindControl("RadEditorNotes"), RadEditor)

 

s = objRadEditor.Content

 

 

End If

 

 

Next

 

 

End Sub

 



ASPX Code:

 

<ProgressTemplate>

 

 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

 

 

<asp:Image ID="ImageSearch" runat="server" ImageAlign="AbsMiddle" ImageUrl="Images/indicator_mozilla_blu.gif" />

 

Processing...

 

</ProgressTemplate>

 

 

</asp:UpdateProgress>

 

 

&nbsp;<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" Visible="true" runat="server">

 

 

<ContentTemplate>

 

 

<telerik:RadGrid ID="RadGridEmpData" runat="server" Width="800px" AllowPaging="True"

 

 

AutoGenerateColumns="False"

 

 

ShowStatusBar="true" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"

 

 

AllowAutomaticUpdates="True"

 

 

GridLines="None" Height="200px" ShowGroupPanel="True" AllowFilteringByColumn="True" >

 

 

<ClientSettings AllowDragToGroup="True">

 

 

<Scrolling FrozenColumnsCount="4"/>

 

 

</ClientSettings>

 

 

<MasterTableView EditMode="PopUp" CommandItemDisplay="Top" Height="200px" >

 

 

<columns>

 

 

<telerik:GridEditCommandColumn EditImageUrl="IMAGES/Editor.gif"></telerik:GridEditCommandColumn>

 

 

<telerik:GridTemplateColumn AllowFiltering="False" SortExpression="EmployeeNo" DataField="EmployeeNo" HeaderText="Employee No" UniqueName="EmployeeNo">

 

 

<ItemTemplate>

 

 

<asp:LinkButton ID="LinkButtonEmployeeNo" runat="server" Text='<%#Eval("EmployeeNo")%>'></asp:LinkButton>

 

<%

--<asp:LinkButton ID="LinkButton1" runat="server"><%#Eval("EmployeeNo")%></asp:LinkButton>--%>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False"

 

 

DataField="ProposalVersionID"

 

 

HeaderText="Proposal Version"

 

 

SortExpression="ProposalVersionID"

 

 

UniqueName="ProposalVersionID">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Site" HeaderText="Site" SortExpression="Site" UniqueName="Site"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="EmployeeName" HeaderText="Employee Name" SortExpression="EmployeeName" UniqueName="EmployeeName"><ItemStyle Width="250px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="OriginalCC" HeaderText="OriginalCC" SortExpression="OriginalCC" UniqueName="OriginalCC"><ItemStyle Width="150px" /></telerik:GridBoundColumn>

 

 

<telerik:GridTemplateColumn DataField="LevelDesc" HeaderText="LevelDesc" UniqueName="TemplateColumn">

 

 

<ItemTemplate>

 

<%

# Eval("LevelDesc") %>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<custom:MyCustomFilteringColumn DataField="LevelDesc" FilterControlWidth="180px" HeaderText="Custom TemplateColumn LevelDesc" UniqueName="TemplateColumn1">

 

 

<headerstyle width="25%" />

 

 

<itemtemplate >

 

<%

# DataBinder.Eval(Container.DataItem, "LevelDesc") %>

 

 

</

 

itemtemplate>

 

 

</custom:MyCustomFilteringColumn>

 

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="CostRate" DataType="System.Decimal" HeaderText="CostRate" SortExpression="CostRate" UniqueName="CostRate"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="AssessmentDate" DataType="System.DateTime" HeaderText="AssessmentDate" SortExpression="AssessmentDate" UniqueName="AssessmentDate"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="CostRate" DataType="System.Decimal" HeaderText="CostRate" SortExpression="CostRate" UniqueName="CostRate"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="BurdenRate" DataType="System.Decimal" HeaderText="BurdenRate" SortExpression="BurdenRate" UniqueName="BurdenRate"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="LaborSchedule" HeaderText="LaborSchedule" SortExpression="LaborSchedule" UniqueName="LaborSchedule"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="LaborCategoryCode" HeaderText="LaborCategoryCode" SortExpression="LaborCategoryCode" UniqueName="LaborCategoryCode"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="ChangedUserId" HeaderText="ChangedUserId" SortExpression="ChangedUserId" UniqueName="ChangedUserId"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="EnteredBy" HeaderText="EnteredBy" SortExpression="EnteredBy" UniqueName="EnteredBy"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="Notes" HeaderText="Notes" SortExpression="Notes" UniqueName="Notes"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="Education" HeaderText="Education" SortExpression="Education" UniqueName="Education"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn AllowFiltering="False" DataField="Experience" HeaderText="Experience" SortExpression="Experience" UniqueName="Experience"><ItemStyle Width="120px" /></telerik:GridBoundColumn>

 

 

</columns>

 

 

<EditFormSettings EditFormType="Template" CaptionDataField="EmployeeNo" CaptionFormatString="Edit Employee Number: {0}" >

 

 

<FormTemplate >

 

 

<table id="Table2" cellspacing="2" cellpadding="1" width="50%" border="1" rules="none"

 

 

style="border-collapse: collapse; background: white;">

 

 

<tr class="EditFormHeader">

 

 

<td colspan="2" style="font-size: small">

 

 

<b> </b></td>

 

 

</tr>

 

 

<tr>

 

 

<td colspan="2">

 

 

<b>Employee Info:</b></td>

 

 

</tr>

 

 

<tr>

 

 

<td style="vertical-align: top; height: 248px; text-align: left">

 

 

<table id="Table6" cellspacing="1" cellpadding="1" width="200" border="0" class="module">

 

 

<tr>

 

 

<td>

 

 

</td>

 

 

<td>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

Employee No:

</td>

 

 

<td>

 

 

<asp:Label ID="LabelEmployeeNo" runat="server" Text='<%# Bind( "EmployeeNo" ) %>'>

 

 

</asp:Label></td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

Employee Name:

</td>

 

 

<td>

 

 

<asp:TextBox ID="TextBoxEmployeeName" runat="server" Text='<%# Bind( "EmployeeName") %>' tabindex="1"></asp:TextBox></td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

CC:

</td>

 

 

<td>

 

 

<asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind( "OriginalCC") %>' TabIndex="2">

 

 

</asp:TextBox></td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

Site:

</td>

 

 

<td>

 

 

<asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind( "Site") %>' TabIndex="3">

 

 

</asp:TextBox></td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

Education:

</td>

 

 

<td>

 

 

<asp:Label ID="LabelEducation" Text='<%# Bind( "LevelDesc") %>' runat="server"></asp:Label></td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

Experience:

</td>

 

 

<td>

 

 

<asp:Label ID="LabelExperience" Text='<%# Bind( "BurdenRate") %>' runat="server"></asp:Label></td>

 

 

</tr>

 

 

</table>

 

 

</td>

 

 

<td style="height: 248px; vertical-align: top; text-align: left;">

 

 

<table id="Table7" cellspacing="1" cellpadding="1" width="250" border="0" class="module">

 

 

<tr>

 

 

<td style="width: 600px">

 

Notes:

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td >

 

 

<telerik:RadEditor ID="RadEditorNotes" runat="server" Height="411px" Width="333px">

 

 

<Content>

 

</

 

Content>

 

 

</telerik:RadEditor>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td align="right" colspan="1" style="vertical-align: top; text-align: left">

 

 

<asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'

 

 

runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' BackColor="AliceBlue" OnClick="btnUpdate_Click">

 

 

</asp:Button></td>

 

 

<td align="right" colspan="2" style="vertical-align: top; text-align: left">

 

<

 

asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"

 

CommandName

 

="Cancel" BackColor="AliceBlue"></asp:Button>

 

 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</FormTemplate>

 

 

<EditColumn UniqueName="EditCommandColumn1">

 

 

</EditColumn>

 

 

<PopUpSettings Modal="True" />

 

 

<FormMainTableStyle Height="200px" Width="400px" />

 

 

</EditFormSettings>

 

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

 

</ContentTemplate>

 

 

</asp:UpdatePanel>

 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Sep 2009, 08:37 PM
Hello Suresh,

You are trying to access the contents too early. I recommend you try slightly different approach:
    Protected Sub RadGridEmpData_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGridEmpData.ItemDataBound 
        If e.Item.IsInEditMode Then 
            Dim s As String 
            s = "" 
            Dim objRadEditor As RadEditor 
            objRadEditor = CType(e.Item.FindControl("RadEditorNotes"), RadEditor) 
            s = objRadEditor.Content 
        End If 
    End Sub 

Best regards,
Daniel
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.
Tags
Grid
Asked by
Suresh Mishra
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or