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

Forums / Developing with Sitefinity / SimpleControl and NewsView as destination

SimpleControl and NewsView as destination

7 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    27 Sep 2009
    Link to this post
    Hi,

    Exist some way to go from one SimpleControl (exposing one itemcontent provider news) to FullNews (NewsView) programaticaly.

    obs:
    SimpleControl not execute OnPreRender event when items are edited in admin side. This is very frustrating because it's very dificult to add style sheets and scripts to the Editor interface and make it more friendly adding width and float styles to dragged controls.

    Regards.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Sep 2009
    Link to this post
    Hi Pierre,

    If you have an NewsView object created you could set the display mode to single item

    nv.DisplayMode = Telerik.Cms.Engine.WebControls.ContentView.DisplayModes.SingleItem; 

    It will be great if you could provide some more information about the custom control you are trying to develop. ContentView base controls as NewsView inherits from ContentBasic, so if you want to get some similar functionality you need to implement it in your class that inherrits from SimpleControl.

    All the best,
    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.
  3. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    28 Sep 2009
    Link to this post
    Hi Ivan,

    Thanks. I have dev one SimpleControl with complex designer that expose one selected items  and link  to one template. The object is  make one News Selector using one template. I have adapted the sfEditor to respect my with and float definitions and be able to add more than one control by line. The result is one news exposed public side using all Metafields used in your template very MVC. All templates are embedded with styles,css, and code but you can use internal or external templates. I use RadComboboxes to as selectors. I have some problems to use my internal resources but this is other thread. Now i need to go to in my detail news using this SimpleControl.  In this case my listofNews not expose NewsViews to use your proposal but use SimpleControl as base.

    Could you help me more to understand what base i need to use to extend SimpleControl base and be able to go from my selected item to Detail News. I searching to make this to use with all providers.


    Thanks, Romi
     
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Sep 2009
    Link to this post
    Hi Pierre,

    You could use GetItemUrl method to get the navigation url of a single News item. Generally once you declare the control - NewsView you should be able to use its functionality and you should be automatically redirected to the single item content.

    Kind regards,
    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.
  5. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    28 Sep 2009
    Link to this post
    Hi,
    I could you explain more ivan, need to change the base SimpleControl to NewsView or ContentBasic to use? or only add in my custom solution using my itemcontent.url. How to come back after go to the detailView need to define some else.
    Thanks  
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Sep 2009
    Link to this post
    Hello Pierre,

    You can use Context.Request["ReturnURL"]; to get back to the list of Items.

    All the best,
    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.
  7. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    28 Sep 2009
    Link to this post
    Hi,

    I have some hazardous issue in InitializeControls in SimpleControl. I have placed one random generator to name my divs during this step. Every item have one value, but some times the Initialize event only generate one value and all items have the same value?. If i debug this step manualy, everytime is ok, but if i use in normal mode, not ok all items have same value. I have placed one while expresion to force to go inside, but not better. ??.

     protected override void InitializeControls(Control controlContainer) 
            { 
                bool rnd=false
                base.InitializeControls(controlContainer); 
                while (!rnd) 
                { 
                    myRandom = GenRandom(); <==== HERE NOT WORKING EVERY TIME!!! BUT WORK IN DEBUG MODE
                    rnd = true
                } 
                RegisterSitefinityEditor();//Doubled because not performed onPrerender 
                if (ToRender != String.Empty) 
                { 
     
                    this.Result.InnerHtml = "<div id='Invic" + myRandom + "' >" + ToRender + "</div>"; 
                } 

    Thanks
     
Register for webinar
7 posts, 0 answered