What is the Sitefinity 5.4 version of ButtonSelector?

Posted by Community Admin on 04-Aug-2018 15:21

What is the Sitefinity 5.4 version of ButtonSelector?

All Replies

Posted by Community Admin on 02-Jul-2013 00:00

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.

Posted by Community Admin on 02-Jul-2013 00:00

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.

Posted by Community Admin on 05-Jul-2013 00:00

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?

Posted by Community Admin on 06-Jul-2013 00:00

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".

Posted by Community Admin on 08-Jul-2013 00:00

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.

Posted by Community Admin on 08-Jul-2013 00:00

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.

Posted by Community Admin on 08-Jul-2013 00:00

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.

Posted by Community Admin on 08-Jul-2013 00:00

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

Posted by Community Admin on 08-Jul-2013 00:00

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.

Posted by Community Admin on 08-Jul-2013 00:00

Did you try this

<sitefinity:ImageField ID="ImageSelector" runat="server" DisplayMode="Write" UploadMode="Dialog" DataFieldName="Image" />

Replacing DataFieldName "Image" with hidBioImage?

Posted by Community Admin on 08-Jul-2013 00:00

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. 

Posted by Community Admin on 08-Jul-2013 00:00

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?

This thread is closed