1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Using userscontrols of builtin modules in custom usercontrols

Using userscontrols of builtin modules in custom usercontrols

7 posts, 0 answered
  1. Wessam
    Wessam avatar
    14 posts
    Registered:
    04 Jan 2007
    12 May 2009
    Link to this post
    Hello,
    I'm trying to create a custom usercontrol in which I'm using the AjaxControlToolKit TabControl. In the tab control I want to use 3 instances of the News View usercontrol. So I was trying to declarativly add them to the custom usercontrol inside the tabs. I want to display different categories in each News View instance.
    Is that possible?
  2. Wessam
    Wessam avatar
    14 posts
    Registered:
    04 Jan 2007
    14 May 2009
    Link to this post

    For example, something like this



     

    <

     

    cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="2">

     

     

     

     

     

    <cc1:TabPanel runat="server" HeaderText="Press Releases" ID="TabPanel1">

     

     

     

     

     

    <ContentTemplate>

     

     

     

     

     

    <uc3:SiteFinityNews runat="server" ID="sf1" />

     

     

     

     

     

    </ContentTemplate>

     

     

     

     

     

    </cc1:TabPanel>

     

     

     

     

     

    <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Press Clipping">

     

     

     

     

     

     

    </cc1:TabPanel>

     

     

     

     

     

    <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="NewsLetters">

     

     

     

     

     

     

    </cc1:TabPanel>

     

    </

     

    cc1:TabContainer>

     

     

     





    The SiteFinityNews tag is registered like this in the control

    <%@ Register src="~/Sitefinity/ControlTemplates/News/ListPageDetails.ascx" tagname="SiteFinityNews" tagprefix="uc3" %>

     

  3. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    15 May 2009
    Link to this post
    Hi Wessam,

    This is possible but you should be using another approach. The control you are referring to is just the template for one of the modes used by the NewsView control.

    In order to place a NewsView control on your template, use the following declaration:
    <%@ Register Assembly="Telerik.News" Namespace="Telerik.News.WebControls" TagPrefix="news" %> 
     
    .... 
    <news:NewsView ID="newsview1" runat="server" /> 

    Note that you have access to the same properties here, as you can see in the designer when you drag and drop a NewsView control on the page. Set the properties according to your needs.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. Wessam
    Wessam avatar
    14 posts
    Registered:
    04 Jan 2007
    31 May 2009
    Link to this post
    Hi Georgi,
    Thanks for the help so far.
    Using NewsView control, I want to display a list of news items that belong to a specific category, and I want to do that declarativily. I found 3 properties for the control that might be used to get the results I want.
    CategoryID
    CategoryKey
    CategoryKeyType
     
    I tried them, but couldn't get it to work the way I want it. In the sitefinity database, I found the table sf_CmsCategory, from which I got the ID of the category I want, and used it to set the CategoryID on the NewsView control, but that didn't help. Any ideas?

    <news:NewsView ID="newsview1" runat="server"   CategoryID="ec99b52f-93a5-47cd-94df-1068bbd01a1f"  />  
  5. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    02 Jun 2009
    Link to this post
    Hi Wessam,

    Set the FilterExpression property of the NewsView control to be Category = "name of category"  
    For example:
    <news:NewsView ID="newsview1" runat="server"  
      FilterExpression="Category = myCategoryName" />  

    I hope this helps you.

    Kind regards,
    Parvan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  6. Antigroove
    Antigroove avatar
    1 posts
    Registered:
    12 Jun 2004
    15 Sep 2009
    Link to this post
    Can anyone point me in the direction of documentation on how to add a News module view to a telerik Tab Strip page.
    similar to the code sample that was provided by Georgi,

    <%@ Register Assembly="Telerik.News" Namespace="Telerik.News.WebControls" TagPrefix="news" %> 
    .... 
    <news:NewsView ID="newsview1" runat="server" /> 

    I'm looking for an expanded explanation of this method of adding module views.

    this code generated an unhandled exception in VS2008 Design view. but is very close to what I'm looking for.

    Thanks
    Wayne
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 May 2017
    16 Sep 2009
    Link to this post
    Hello Antigroove,

    The sample you wrote does not have anything to do with a module and backend views. The code just declare NewsView control.

    However, below is a sample declaration that Illustrates integrating RadTabStrp with RadMultiPage and NewsView control.

    <%@ Register Assembly="Telerik.News" Namespace="Telerik.News.WebControls" TagPrefix="news" %>  
     
    <telerik:RadTabStrip ID="ts1" runat="server" MultiPageID="RadMultiPage1" Skin="Outlook"
    <Tabs> 
    <telerik:RadTab Text="tab1" runat="server" PageViewID="Pageview1" /> 
    <telerik:RadTab Text="tab2" runat="server" PageViewID="Pageview2" /> 
    <telerik:RadTab Text="tab3" runat="server" PageViewID="Pageview3" /> 
    </Tabs> 
    </telerik:RadTabStrip> 
     
     <telerik:RadMultiPage id="RadMultiPage1" runat="server" SelectedIndex="0" Width="400"
      <telerik:RadPageView id="Pageview1" runat="server"
      <news:NewsView ID="nv1" runat="server" /> 
      </telerik:RadPageView> 
      <telerik:RadPageView id="Pageview2" runat="server"
        <asp:Label ID="lb1" runat="server" Text="RadPageView2" /> 
      </telerik:RadPageView> 
        <telerik:RadPageView id="Pageview3" runat="server"
          <asp:Label ID="Label2" runat="server" Text="RadPageView3" /> 
      </telerik:RadPageView> 
    </telerik:RadMultiPage> 


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
7 posts, 0 answered