More in this section

Forums / Developing with Sitefinity / How to create a public control to show single item in Generic content based module

How to create a public control to show single item in Generic content based module

4 posts, 0 answered
  1. Priti
    Priti avatar
    17 posts
    Registered:
    20 Nov 2008
    29 Dec 2008
    Link to this post
    Hi,

    I have created my Generic content based module based on Products module. In this module there is only one public control - ProductsView - which lists all the products. ContentViewSingleItem template is there but SingleItemView is not a public control and I could not find corresponding .cs class in Telerik.Samples.Products project using which I can make the control a public control.

    How can I make ContentViewSingleItem control a public control so that I can direclty display single item from module content items (e.g. single product) on my page and that too with whatever layout that I want.?

    Thanks,
    Priti.

  2. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    05 Jan 2009
    Link to this post
    Hello Priti,

    The file you refer to (ContentViewSingleItem) is a template, not a control. This template is used for one of the two modes of the ProductsView control.

    The ProductsView control works identically to ContentView control. It is in two modes - Master and Detail. Master is used for displaying a list of items, while Detail is for displaying a single item.

    If you would like to change the look and feel of the public control, you should copy the respective template (ContentViewSingleItem or ContentViewItemList), rename it, change it and set the path to the new template in the Template Path property of the public control (page Edit mode, properties of the control, Advanced tab,  Appearance section -> either ItemListTemplatePath or SingleItemTemplatePath). You could also alter the CSS.

    Let us know if you need further assistance.
        

    Greetings,
    Sonya
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Priti
    Priti avatar
    17 posts
    Registered:
    20 Nov 2008
    06 Jan 2009
    Link to this post
    Hi Sonya,

    Thanks for the reply. But that doesn't solve my problem.
    I think I am also saying that ContentViewSingleItem is a template and not a control. There is only one Public control in this module and that is ProductView. So you can achieve single item view only through the ProductView control. I want to change this functionality.

    I want to create a public control for Single Item view. I may set the Item ID at runtime/design time or I may show the random item in this control. But I donot want that user first views the item list, clickes on any of the item name and then sees the item details. How can I achive that?

    Please help.

    Thanks,
    Priti.
  4. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    06 Jan 2009
    Link to this post
    Hi Priti,

    We still recommend using the ProductsView control. There is a section Obsolete members (page Edit mode, properties of the control) which has a property SelectedItemId - it could be set to the ID of the specific item ID. You will need to extend the control, though, by adding a selector to the Behavior section which will provide the functionality to select the single item which will be displayed. Note that the mode should be set to Detail (Single Item).

    For more information on creating a new property, see Implementing Properties in Controls
    For more information on making a selector, see Implementing TypeEditors for Complex Properties .

    Hope this helps. Let us know if you need further assistance.

    Sincerely yours,
    Sonya
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered