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

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

2 Answers 184 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 21 Dec 2011, 12:37 AM
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 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 21 Dec 2011, 12:34 PM
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
0
Steven
Top achievements
Rank 1
answered on 21 Dec 2011, 04:04 PM
thanks for the fix. I tried all sorts of combinations escaping stuff but didnt change the escaped single quotes to double quotes
Tags
ListBox
Asked by
Steven
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Steven
Top achievements
Rank 1
Share this question
or