More in this section

Forums / General Discussions / Help for dropdownList as liked metafiedl

Help for dropdownList as liked metafiedl

2 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    16 Feb 2006
    23 Oct 2007
    Link to this post

    I search to create one box selector to add one style in the NewsList template.  This DropDownlist change the class name in one div class.
    I have added as metafields in the News, but how to construct the boxselector to change my class name? . My  Metafields is :News.IdNewsClass
                                       Boxselector         Class (short-text)
     DropDownList :      Normal                StdNews
                                       see                       SeeNews
                                       Important             ImportantNews

     Could you help me to create de boxselector to put in the Templates.

     <asp:Label ID="Label9" AssociatedControlID="IdNewsClass" runat="server"><asp:Literal ID="Literal24" runat="server" Text="<%$Resources:IdNewsClass %>"></asp:Literal> <em id="Em2" runat="server"></em></asp:Label>

            <asp:DropDownList ID=" ?? " runat="server">

            <p class="example"><asp:Literal ID="Literal25" runat="server" Text="<%$Resources:IdNewsClassNote %>"></asp:Literal></p>

     How to populate with class names :stdNews, SeeNews,ImportantNews

  2. Slavo
    Slavo avatar
    295 posts
    24 Sep 2012
    24 Oct 2007
    Link to this post

    Hello Pierre,

    Just to make sure we are on the same boat, here is how I understand your situation:

    You want to have three types of news items - normal, see (I don't know what that is), and important. You want these news items to be styled differently in the list. You have setup css for three different css classes, and you want to apply different class, depending on the type of news item.

    First, I want to clarify that the news items in a single list cannot be styled differently, because in the back end there is no difference between them. If you want to have three separate NewsLists styled differently, then you need to create three templates and manually set the template for each one by using the TemplateUrl property of the NewsList control. Then you can create three categories for news, and bind the different NewsList controls to the respective category.

    The role of the templates for the controls is to take out the presentation of the control and separate it from code. You can also provide multiple templates for the same control in different scenarios. However, the templates are not controls by themselves (although they are .ascx files), and cannot be modified in design time or runtime. Your only solution in this case is to create separate templates. Changing css classes by a dropdown in design time cannot be done with a template.

    Please excuse me if I misunderstood your problem. In this case, tell us clearly what you want to achieve and we will do our best to help you.


    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
2 posts, 0 answered