How to set RadPanelItem.Text property using c# code block?

2 posts, 0 answers
  1. Syam
    Syam avatar
    1 posts
    Member since:
    Aug 2010

    Posted 17 Aug 2010 Link to this post

    how can i set the text property of the RadPanelItem using the inline c# code block? my code line is below. the variables are declared as global "protected string" in the c# code.


    <telerik:RadPanelBar runat="server" ID="RadPanelBar1" Skin="Web20">
            <telerik:RadPanelItem Text="Quick Links" Expanded="true" PreventCollapse="true">
                    <telerik:RadPanelItem Text="<%= textProperty %>" NavigateUrl="<%= urlProperty %>" />



  2. Nikolay Tsenkov
    Nikolay Tsenkov avatar
    734 posts

    Posted 17 Aug 2010 Link to this post

    Hi Syam,

    You can use the DataBinder.Eval method to evaluate data from the container the expression is currently in.
    Here is the API reference for this method:

    Also, here is an alternative way of binding data, which by my opinion is the better (more clear for reading than the inline one):
    <telerik:RadPanelBar ID="RadPanelBar1" runat="server" DataSourceID="SqlDataSource1" DataFieldID="id" DataFieldParentID="ParentId">
            <telerik:RadPanelItemBinding Depth="0" TextField="Text" Expanded="true" />
            <telerik:RadPanelItemBinding FormatString="Level 1 > {0}" TextField="Text" Depth="1" />
            <telerik:RadPanelItemBinding FormatString=" Level 2 > {0}" TextField="Text"
                Depth="2" />

    For additional reference to dataBinding in RadPanelBar, here is a link to the "Overview" article in the DataBinding section of the help pages for this control:

    Hope this is helpful for you!

    Nikolay Tsenkov
    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
  3. DevCraft R3 2016 release webinar banner
Back to Top