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

Forums / Developing with Sitefinity / What is the Sitefinity 5.4 version of ButtonSelector?

What is the Sitefinity 5.4 version of ButtonSelector?

12 posts, 0 answered
  1. Lurch
    Lurch avatar
    64 posts
    Registered:
    18 Jan 2011
    02 Jul 2013
    Link to this post
    What is the Sitefinity 5.4 version of:

    <sf:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" AssociatedControls="hidBioImage,imgBio" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/Libraries/Dialogs/ButtonSelector.ascx" runat="server" cssclass="pickerWrapper" ButtonText="Select Image" />

    I know that other people have been told to use the MediaContentSelectorView control, however I don't want that, I need to "Insert and Image" dialogue box, that pops up with the default Image widget.

    I have attached an image of that box for your review.

    Why on earth this functionality was removed after 3.7 SP4, I don't know.
  2. Jonathan
    Jonathan avatar
    119 posts
    Registered:
    19 Dec 2012
    02 Jul 2013 in reply to Lurch
    Link to this post
    I've used this on a 5.3 site.  I used this in the Backend on a designer.
    <sitefinity:ImageField ID="ImageSelector" runat="server" DisplayMode="Write" UploadMode="Dialog" DataFieldName="Image" />

    I would change the DataFieldName to what corresponds to you.  "Image" was a field name in a custom module for me.

  3. Lurch
    Lurch avatar
    64 posts
    Registered:
    18 Jan 2011
    05 Jul 2013
    Link to this post
    Thanks for the tip.

    When you say "I would change the DataFieldName to what corresponds to you.", are you referring to the ID of the image that I am updating?
  4. Jonathan
    Jonathan avatar
    119 posts
    Registered:
    19 Dec 2012
    06 Jul 2013 in reply to Lurch
    Link to this post
    If this is a DynamicModule or widget that you are using the "Image" would be the name of the field in sitefinity that is stored in the Database.  For me the field name was "Image".
  5. Lurch
    Lurch avatar
    64 posts
    Registered:
    18 Jan 2011
    08 Jul 2013
    Link to this post
    I have to do something different. I have a personnel bios page, that displays the image of a person, with a link underneath it to select a new image to replace the one above.

    So when you click the link and choose a new image, the image displayed above the link is updated to the new one you selected.

    Then once I go to save to the database, I can use the image "src" value, as the path to the image to be stored in the database.

    So I need to be about to link that control to an image control ID, displayed on the page.
  6. Jonathan
    Jonathan avatar
    119 posts
    Registered:
    19 Dec 2012
    08 Jul 2013 in reply to Lurch
    Link to this post
    How is the personnel bio built?  Are you using the built in profiles for sitefinity users? If so that is built right into the profile view widget.  This would be my suggestion if possible for your implementation.

    How to use and set up profile/user widget.
  7. Lurch
    Lurch avatar
    64 posts
    Registered:
    18 Jan 2011
    08 Jul 2013
    Link to this post
    Unfortunately that does not have anything to do with Sifefinity profiles. This control is maintaining a table in our MSSQL database, of a list of people that are displayed on a web page. The people displayed are Directors and Executives that do not use our Sitefinity CMS, so they do not have any profiles.
  8. Jonathan
    Jonathan avatar
    119 posts
    Registered:
    19 Dec 2012
    08 Jul 2013 in reply to Lurch
    Link to this post
    I am guessing that you are creating this via a user control in some custom code. Also based on the fact you need some custom implementation with a custom table.  So I might suggest that you look at some of the RadControls

    Upload Control

    Or this example using the rad grid make the data source your custom table to allow edits and viewing. example
  9. Lurch
    Lurch avatar
    64 posts
    Registered:
    18 Jan 2011
    08 Jul 2013 in reply to Jonathan
    Link to this post
    Yes, I am building a custom widget, which displays a radGrid with Bio information from the database. When I click on a name, I use the asp:multiview control, to display a form where the user can update the Bio details.

    On that form is an image control, to update the persons photo. It is there I want to have a "Select an Image" link that pops up Sitefinity's standard dialogue box, to allow uploading or selecting from the existing image library.

    This is so frustrating, as in 3.7 SP4, all you had to do was:

    <img id="imgBio" runat="server" src="test" /><br />
    <asp:HiddenField ID="hidBioImage" runat="server" />
    <sf:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" AssociatedControls="hidBioImage,imgBio" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/Libraries/Dialogs/ButtonSelector.ascx" runat="server" cssclass="pickerWrapper" ButtonText="Select Image" />

    ...and you had a link that pops up Sitefinites image selector dialouge box. Now it appears I have to write hundreds of lines of code to do something I could in the past with 3.
  10. Jonathan
    Jonathan avatar
    119 posts
    Registered:
    19 Dec 2012
    08 Jul 2013 in reply to Lurch
    Link to this post
    Did you try this
    <sitefinity:ImageField ID="ImageSelector" runat="server" DisplayMode="Write" UploadMode="Dialog" DataFieldName="Image" />

    Replacing DataFieldName "Image" with hidBioImage?
  11. Lurch
    Lurch avatar
    64 posts
    Registered:
    18 Jan 2011
    08 Jul 2013 in reply to Jonathan
    Link to this post
    Sorry. Putting that line of code as suggested throws a JavaScript runtime error, with a Sys.WebForms.PageRequestManagerServerErrorException.

    I have attached a screenshot of the offending error text. 
  12. Lurch
    Lurch avatar
    64 posts
    Registered:
    18 Jan 2011
    08 Jul 2013
    Link to this post
    Another thing that may help, is that this is NOT the widgets controller, but in the widget itself. It is designed to display along with the widget's contents, not as part of it's property display in the control designer.

    So I guess this is why a lot of the examples are not working for me, as I'm trying to use them in the widget itself, and the code assumes I am using the designer associated the widget?
12 posts, 0 answered