More in this section

Forums / Developing with Sitefinity / User Control Refresh

User Control Refresh

6 posts, 0 answered
  1. Thomas
    Thomas avatar
    7 posts
    Registered:
    07 May 2008
    10 Mar 2009
    Link to this post
    I have a master page that has a user control component in it (a navigation control).  When I first open a page (that utilizes this master page) in edit mode, everything looks great.  However, if I pull some controls over or do anything that posts the page back, the user control is not refreshed.  It's still there, but I'd like to force it to show so that the client that will eventually be using the CMS will not get confused.  Any suggestions?

    Thomas
  2. Mike
    Mike avatar
    221 posts
    Registered:
    19 Aug 2008
    10 Mar 2009
    Link to this post
    The same thing happen over here... Never really thought much of it but would be interested in a fix - if there is one...

    Duncan
  3. Joel
    Joel avatar
    10 posts
    Registered:
    04 Oct 2008
    10 Mar 2009
    Link to this post
    You could program the user control to function differently based on security (if someone is authenticated or not) ~ unless you are using security on the front end, in which case you could even go so far as to check the current user's role to check to see what to display. I am not sure if that would solve your problem, just a quick thought.
  4. Joel
    Joel avatar
    10 posts
    Registered:
    04 Oct 2008
    10 Mar 2009
    Link to this post
    I believe I might have misunderstood your request after re-reading :).
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    12 Mar 2009
    Link to this post
    Hi Thomas,

    I am not sure that I understand your request.
    What should the control reflect, after the postback? Since it is navigation control, I assume it is showing the pages. While you are in edit page, you are working on a staged version, not in a page included in the sitemap. Most probably your navigation control is bound to the Sitemap, and the page will be included in the sitemap after you publish it.
    Is this the scenario?

    Best wishes,
    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.
  6. Mike
    Mike avatar
    221 posts
    Registered:
    19 Aug 2008
    12 Mar 2009
    Link to this post
    I believe i see what Thomas is referring to (i think), but it has to do with the nature of the custom control itself... For example if you have built your control to only bind data " if (!IsPostBack) " the you might not see any data being bound to the control when you drag it onto the page being edited as i believe this action is a Postback (not a page refresh)

    I suppose you could check to see if the control is being used in the administration portion of the CMS:

    CmsManager cmsManager = new CmsManager(); 
    ICmsUrlContext context = CmsUrlContext.Current; 
     
     
    CmsPageBase page = (CmsPageBase)cmsManager.GetPage(context.PageID, false); 
    if (page.PageMode == CmsPageMode.Preview) 
        return true
    else if (page.PageMode == CmsPageMode.Edit) 
        return true


    And then perform the load of the control differently:


    protected void Page_Load(object sender, EventArgs e) 
        if (ISCms) //The return value from code above 
        { 
            //BIND CONTROL DATA 
        } 
        else 
        { 
            if (!IsPostBack) 
            { 
                //BIND CONTROL DATA 
            } 
        } 

    At least this is my understanding of the question... I figured out pretty fast that when developing controls for the CMS that they must be developed both for the public side and the administrative pages... Checking to see if the control is being view int he administrative pages is important and the controls should behave differently when in public or admin....

    Hope i was of some help... :)

    Duncan

Register for webinar
6 posts, 0 answered