server tag is not well formed with trying to assign am attribute to a text field

3 posts, 0 answers
  1. Steven
    Steven avatar
    32 posts
    Member since:
    Jul 2012

    Posted 20 Dec 2011 Link to this post

    the following works but when i try to assign the eval to the text field, I get server tag is not formed correctly. Any idea how to get it to work?

    <
    telerik:RadListBox ID="AssignedFieldsGV" runat="server" Width="375px" Height="500px" AllowTransferOnDoubleClick="true"  ItemDataBound ="AssignedFieldsGV_ItemDataBound "
        SelectionMode="Multiple"  EnableDragAndDrop="true"  AutoPostBack="true"  
        >
       <HeaderTemplate>
             Assigned Fields               
       </HeaderTemplate>
       <ItemTemplate>
            <table>
                <tr>
                    <td style="width:125px;">   <asp:Label ID="Label1" runat="server"  Text='<%# DataBinder.Eval(Container, "Text")%>' /></td>
                    <td style="width:255px;">  <asp:TextBox ID="Label2" runat="server"   />    <%# DataBinder.Eval(Container, "Attributes['DisplayName']") %>      </td>
                </tr>
            </table>
        </ItemTemplate>
     
    </telerik:RadListBox>


    for label2, when I try to assign it as Text I get server tag is not well formed, any idea whats wrong?
    <telerik:RadListBox ID="AssignedFieldsGV" runat="server" Width="375px" Height="500px" AllowTransferOnDoubleClick="true" ItemDataBound ="AssignedFieldsGV_ItemDataBound "
    SelectionMode="Multiple" EnableDragAndDrop="true" AutoPostBack="true"
    >
    <HeaderTemplate>
    Assigned Fields
    </HeaderTemplate>
    <ItemTemplate>
    <table>
    <tr>
    <td style="width:125px;"> <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "Text")%>' /></td>
    <td style="width:255px;"> <asp:TextBox ID="Label2" runat="server" Text=' <%# DataBinder.Eval(Container, "Attributes['DisplayName']") %>' /> </td>
    </tr>
    </table>
    </ItemTemplate>
    </telerik:RadListBox>
  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 21 Dec 2011 Link to this post

    Hi Steven,

    The problem is that when you put the expression inside the TextBox's Text property,  you are using 3 sets of quotes. To distinguish the innermost set, the one around DisplayName, from the others, just escape them with \". In other words, your expression should look like this:

    <asp:TextBox ID="Label2" runat="server" Text=' <%# DataBinder.Eval(Container, "Attributes[\"DisplayName\"]") %>' />
    Greetings,
    Bozhidar
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steven
    Steven avatar
    32 posts
    Member since:
    Jul 2012

    Posted 21 Dec 2011 Link to this post

    thanks for the fix. I tried all sorts of combinations escaping stuff but didnt change the escaped single quotes to double quotes
Back to Top