'answer<%# DataBinder.Eval(Container.DataItem, "QuestionId") %>' is not a valid identifier.

Last post 07-15-2009, 7:43 AM by bala_pragasam. 2 replies.
Sort Posts: Previous Next
  •  07-14-2009, 8:43 AM 53954

    'answer<%# DataBinder.Eval(Container.DataItem, "QuestionId") %>' is not a valid identifier.

    Hello
    I would like to replace textarea tiny_mce editor with CuteEditor. I am evaluating at the moment. However it doesn't work.
     
    <textarea id="answer<%#DataBinder.Eval(Container.DataItem, "QuestionId")%>" name="answer<%#DataBinder.Eval(Container.DataItem, "QuestionId")%>" cols="50" rows="4"><%#DataBinder.Eval(Container.DataItem, "AnswerText")%></textarea>

    with this ...

    <
    CE:Editor ID='answer<%# DataBinder.Eval(Container.DataItem, "QuestionId") %>' Text='<%#DataBinder.Eval(Container.DataItem, "AnswerText")%>' runat="server" ></CE:Editor>
     
    but it doesn't work. Do you have any suggestion as how to fix this.
     
    Many thanks.
     
     
     
  •  07-15-2009, 2:35 AM 53989 in reply to 53954

    Re: 'answer<%# DataBinder.Eval(Container.DataItem, "QuestionId") %>' is not a valid identifier.

    Hi bala_pragasam,
     
    Cute Editor  is a server control, properties ID can not be binding, if you want to bing the text, tye the example below
    1. <%@ Page Language="C#" AutoEventWireup="True" Debug="true" %>   
    2.   
    3. <%@ Import Namespace="System.Data" %>   
    4. <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>   
    5. <html>   
    6.   
    7. <script runat="server">   
    8.     
    9.     ICollection CreateDataSource()   
    10.     {   
    11.         DataTable dt = new DataTable();   
    12.         DataRow dr;   
    13.         dt.Columns.Add(new DataColumn("StringValue"typeof(String)));   
    14.         for (int i = 0; i < 2; i++)   
    15.         {   
    16.             dr = dt.NewRow();   
    17.             dr[0] = "Description for item " + i.ToString();   
    18.             dt.Rows.Add(dr);   
    19.         }   
    20.         DataView dv = new DataView(dt);   
    21.         return dv;   
    22.     }   
    23.     void Page_Load(Object sender, EventArgs e)   
    24.     {   
    25.         if (!IsPostBack)   
    26.         {   
    27.             ItemsList.DataSource = CreateDataSource();   
    28.             ItemsList.DataBind();   
    29.         }   
    30.     }   
    31.     
    32. </script>   
    33.   
    34. <body>   
    35.     <form id="Form1" runat="server">   
    36.         <h3>   
    37.             Example</h3>   
    38.         <asp:DataList ID="ItemsList" runat="server">   
    39.             <ItemTemplate>   
    40.                 <CE:Editor ID="editor1" runat="server" Text='<%# Eval("StringValue") %>'>   
    41.                 </CE:Editor>   
    42.             </ItemTemplate>   
    43.         </asp:DataList>   
    44.     </form>   
    45. </body>   
    46. </html>  
    Regards,
     
    ken
  •  07-15-2009, 7:43 AM 53996 in reply to 53989

    Re: 'answer<%# DataBinder.Eval(Container.DataItem, "QuestionId") %>' is not a valid identifier.

    Thanks.
View as RSS news feed in XML