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

Not sure how to write server variables to ItemTemplate

1 Answer 63 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 23 Mar 2010, 04:25 PM

I have the following code and it seems to work fairly well:

<table cellpadding="0" border="0" cellspacing="0">  
    <tr> 
        <td><%= Class.Property %></td>  
    </tr> 
</table> 
 

Now the problem is that the data doesnt get written when I place the previous code in a RadPanelBar ItemTemplate:
<telerik:RadPanelBar ID="SummaryPanelBar" runat="server">  
    <Items> 
        <telerik:RadPanelItem Text="General">  
            <ItemTemplate> 
<table cellpadding="0" border="0" cellspacing="0">  
    <tr> 
        <td><%= Class.Property %></td>  
    </tr> 
</table> 
            </ItemTemplate> 
        </telerik:RadPanelItem> 
    </Items> 
</telerik:RadPanelBar> 
 

Any clue as to why?

J

1 Answer, 1 is accepted

Sort by
0
Accepted
Simon
Telerik team
answered on 26 Mar 2010, 03:18 PM
Hi J,

The "<%= %>" used in a value of a property in the declarative markup of a control do not work as expected. The expressions are intended to write some HTML directly to the output stream when the page is actually being written (to the stream).

You can use a binding expression "<%# %>", which assigns the evaluated result to the respective property, e.g.
<telerik:RadPanelBar ID="SummaryPanelBar" runat="server"
    <Items>
        <telerik:RadPanelItem Text="General"
            <ItemTemplate>
<table cellpadding="0" border="0" cellspacing="0"
    <tr>
        <td><%# Class.Property %></td
    </tr>
</table>
            </ItemTemplate>
        </telerik:RadPanelItem>
    </Items>
</telerik:RadPanelBar>

This, however will only work when the respective Item's DataBind method has been called or (the DataBind method of the parent RadPanelBar).

Sincerely yours,
Simon
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
PanelBar
Asked by
J
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or