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

Forums / Developing with Sitefinity / Content Selector Returns Guid

Content Selector Returns Guid

4 posts, 0 answered
  1. Casey
    Casey avatar
    25 posts
    Registered:
    22 Oct 2010
    27 Apr 2011
    Link to this post
    I'm using a custom content selector based on the sitefinity WebUITypeEditor<Guid>. After the editor selects an item then it returns a guid to the control that represents the property i put the ([WebEditor("TabContentSelector, App_Code")]) attribute on.

    Is there a way i could also set a readonly property that would display the selected content's name. I tried to do it inside the property's set method but the property apparently doesn't get set immediately after the guid is put in the textbox.

    I know how to get the content name:
    var manager = new ContentManager("Tab_Content");
    var content = manager.GetContent(new Guid(contentGuid));
    return content.GetMetaData("Name").ToString();

    i just don't know where to put it so that the name will be set as soon as the guid is selected. Do you know how i can do this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    03 May 2011
    Link to this post
    Hi Casey,

    Where you are trying to display the selected content name? Somewhere in the selector, inside a control designer or in the actual control? In all ways you need to bind some control to the returned ID, so CreateChildControls/InitializeControls should be called or you have to explicitly do this by using EnsureChildControls

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Casey
    Casey avatar
    25 posts
    Registered:
    22 Oct 2010
    03 May 2011
    Link to this post
    thanks for your response.

    i want to show the content name in the control editor after the editor picks content using the content selector. so after they click done in the content selector i want to set one property (textbox) in the default control editor to the guid and set another textbox to the content name.

    the guid is getting set. the guid is returned using the "Value" property in the selector (WebUiTypeEditor). but i'm not sure how to set the other property (content name). i tried doing it inside the control's guid property setter but that doesn't show in the control editor's textbox until i close and reopen the control editor.

    so i'm still not sure how to accomplish this. it looks like even if i set the other property (content name) the textbox is not updated in the control editor after the selector closes. do you know how i can get both textboxes to update after the content selection is done?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    09 May 2011
    Link to this post
    Hello Casey,

    Each control designer has a method OnSaving() called by the ControlEditor when the component is about to be saved. Before that the control data will not be updated, because the properties are still not persisted.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered