0

I am using the ajax control toolkit HTML editor. I am trying to retrieve the editor value but i am getting the error

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor"
    TagPrefix="cc1" %>
<asp:GridView ID="uxResultsGrid" runat="server" Width="100%" AllowSorting="True"
                        AutoGenerateColumns="False" PageSize="25" AllowPaging="True" BackColor="White"
                        BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" RowStyle-VerticalAlign="Top"
                        RowStyle-HorizontalAlign="Left" OnPageIndexChanging="uxResultsGrid_PageIndexChanging"
                        OnSorting="uxResultsGrid_Sorting" OnRowEditing="uxResultsGrid_RowEditing">
                        <Columns>
                            <asp:TemplateField HeaderText="Action" HeaderStyle-ForeColor="Blue">
                                <ItemTemplate>
                                    <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="Edit" CssClass="FormsManagerButton"
                                        CausesValidation="False" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Key" SortExpression="configkey">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("configkey") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" Wrap="False" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Value" SortExpression="configval">
                                <EditItemTemplate>
                                    <cc1:Editor ID="HTMLeditor" runat="server" Width="100%" Height="200" Content='<%# Bind("configval") %>' />
                                  <%--  <asp:TextBox ID="editor" runat="server" Width="100%" Text='<%# Bind("configval") %>' />--%>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("configval") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" Width="40%" Wrap="True" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Created" SortExpression="created">
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("created") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" Wrap="False" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Created By" SortExpression="created_by">
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("created_by") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" Wrap="False" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Updated" SortExpression="updated">
                                <ItemTemplate>
                                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("updated") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" Wrap="False" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Updated By" SortExpression="updated_by">
                                <ItemTemplate>
                                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("updated_by") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" Wrap="False" />
                            </asp:TemplateField>
                        </Columns>
                        <PagerSettings Position="TopAndBottom" />
                        <PagerStyle HorizontalAlign="Left" />
                        <RowStyle HorizontalAlign="Left" VerticalAlign="Top"></RowStyle>
                    </asp:GridView>

I am trying to retrieve the edited value using the c#

var configeditvalue= HTMLeditor.Content;

but i am getting the below error

Error   94  The name 'HTMLeditor' does not exist in the current context 
user3089816
  • 191
  • 1
  • 8
  • 21
  • 1
    Your control ID is defined within a template. See this answer for information regarding accessing your control by ID. http://stackoverflow.com/questions/14584175/how-to-find-control-in-edit-item-template – billb Jun 01 '16 at 20:24
  • Thank you for the clarification . If the textbox is existed we can retrieve the value GridViewRow row = uxResultsGrid.Rows[e.NewEditIndex]; TextBox txtvalues = (TextBox)row.FindControl("tcteditor"); like this if i want to retrieve the html editor control value how it is possible, Can you help me with this..@ billb – user3089816 Jun 01 '16 at 20:56
  • The link I provided should show you how to retrieve the editor control. When you followed that solution what happened? – billb Jun 03 '16 at 17:27

0 Answers0