More in this section

Forums / Designing with Sitefinity / Show "invisible" div's in Sitefinity backend

Show "invisible" div's in Sitefinity backend

2 posts, 0 answered
  1. James@Nw
    James@Nw avatar
    265 posts
    05 May 2009
    31 May 2010
    Link to this post
    Hi Again guys,

    I have four content blocks which I am hiding using CSS with Generic Content Controls in them which the client can change. I need however for those hidden divs to show when you are in the backend of Sitefinity.

    How would I go about doing something like that?

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    31 May 2010
    Link to this post
    Hi James,

    Map the external template for GenericContent control - GenericContentDesigner.ascx. Inside the template override OnInit event and subscribe for PreRender event of RadEditror control. Inside PreRender event of the RadEditor control you can get the content as a string, find the divs you are hiding and change them, so that the content will appear visible when you are editing the content through the ControlDesigner.

    protected override void OnInit(EventArgs e)
         textEditor.PreRender += new EventHandler(textEditor_PreRender);
     void textEditor_PreRender(object sender, EventArgs e)
             // get the rad editor
             var radeditorObject = sender as RadEditor;
             // get the content as a string - the html will be added.
             string cnt = radeditorObject.Content;
             // modify the content/html so that you will see it.

    Another  option would be using a separate control with the same purpose. In the custom control you could have predefined divs that wraps the content. In edit mode you can change the Visible property of the divs

    if (HttpContext.Current.Request.QueryString["cmspagemode"] == "edit")
      // you are in edit mode.
      div1.visible = true;

    Sincerely yours,
    Ivan Dimitrov
    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.
2 posts, 0 answered