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

Forums / Developing with Sitefinity / Multiple images on news item

Multiple images on news item

12 posts, 1 answered
  1. Gokhan
    Gokhan avatar
    32 posts
    Registered:
    11 Jul 2008
    01 Feb 2010
    Link to this post
    Hi;

    how can i enable users to add multiple images to news item. As a default , you can just pick a thumbnail. Do i need to associate news item with image gallery . I just wonder there is a work that i can inspire . Thank you 
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Feb 2010
    Link to this post
    Hello Gokhan,

    1. You need to map NewsItemNew and NewsItemEdit templates to NewsView module
    2. Add multiple ButtonSelector control inside ContentMetafields control in both templates

    <li class="selector">
                          <asp:Label ID="Label2" AssociatedControlID="Thumbnail" runat="server"><asp:Literal ID="Literal14" runat="server" Text="<%$Resources:Thumbnail %>"></asp:Literal> <em id="ThumbnailLabel" runat="server"></em></asp:Label>
                          <asp:TextBox ID="Thumbnail" Text="" runat="server" MaxLength="250"></asp:TextBox>
                          <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" AssociatedControls="Thumbnail" runat="server" cssclass="pickerWrapper" ButtonText="<%$Resources:Select%>" />
                          <p class="example">
                              <asp:Literal ID="Literal15" runat="server" Text="<%$Resources:ThumbnailNote %>"></asp:Literal>
                          </p>
                      </li>

    3. Then you need to resolve the dynamic link for the public templates of NewsView control.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Gokhan
    Gokhan avatar
    32 posts
    Registered:
    11 Jul 2008
    01 Feb 2010
    Link to this post
    Hi Ivan;

    thanx for quick reply. The number of thumbnail can vary therefore can i bind GalleryControlDesigner or image GalleryControlDesigner instead of binding ImageEditorDialog on a template. I tried quickly but couldnt make it run. 
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Feb 2010
    Link to this post
    Hi Gokhan,

    GalleryControlDesigner will not help. The button selector opens all image galleries and images inside each particular gallery. It would not be possible to generate the thumbnail controls dynamically, because you will not be able to resist the control value and retrieve back the correct number of controls when you edit this content item. Also, adding custom metafields to backend views require metakey registration in the web.confiog file.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Gokhan
    Gokhan avatar
    32 posts
    Registered:
    11 Jul 2008
    01 Feb 2010
    Link to this post
    ok i decided to use limited number of images. add multiple image selectors but when i insert images , GUID is being written into first textbox

    what is wrong with following code:

       <p> Select images (maximum 5 images)</p>
                        <br />
                        <li class="selector">
                            <asp:Label ID="Label2" AssociatedControlID="Thumbnail" runat="server"><asp:Literal ID="Literal14" runat="server" Text="<%$Resources:Thumbnail %>"></asp:Literal> <em id="ThumbnailLabel" runat="server"></em></asp:Label>
                            <asp:TextBox ID="Thumbnail" Text="" runat="server" MaxLength="250"></asp:TextBox>
                            <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" AssociatedControls="Thumbnail" runat="server" cssclass="pickerWrapper" ButtonText="<%$Resources:Select%>" />
                           
                            <p class="example">
                                <asp:Literal ID="Literal15" runat="server" Text="<%$Resources:ThumbnailNote %>"></asp:Literal>
                            </p>
                        </li>
                          <li class="selector">
                            <asp:Label ID="Label9" AssociatedControlID="Thumbnail2" runat="server"><asp:Literal ID="Literal19" runat="server" Text="<%$Resources:Thumbnail %>"></asp:Literal> <em id="Em2" runat="server"></em></asp:Label>
                            <asp:TextBox ID="Thumbnail2" Text="" runat="server" MaxLength="250"></asp:TextBox>
                            <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" AssociatedControls="Thumbnail2" runat="server" cssclass="pickerWrapper" ButtonText="<%$Resources:Select%>" />
                           
                            <p class="example">
                                <asp:Literal ID="Literal21" runat="server" Text="<%$Resources:ThumbnailNote %>"></asp:Literal>
                            </p>
                        </li>
                          <li class="selector">
                            <asp:Label ID="Label10" AssociatedControlID="Thumbnail3" runat="server"><asp:Literal ID="Literal24" runat="server" Text="<%$Resources:Thumbnail %>"></asp:Literal> <em id="Em3" runat="server"></em></asp:Label>
                            <asp:TextBox ID="Thumbnail3" Text="" runat="server" MaxLength="250"></asp:TextBox>
                            <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" AssociatedControls="Thumbnail3" runat="server" cssclass="pickerWrapper" ButtonText="<%$Resources:Select%>" />
                           
                            <p class="example">
                                <asp:Literal ID="Literal25" runat="server" Text="<%$Resources:ThumbnailNote %>"></asp:Literal>
                            </p>
                        </li>
                          <li class="selector">
                            <asp:Label ID="Label11" AssociatedControlID="Thumbnail4" runat="server"><asp:Literal ID="Literal26" runat="server" Text="<%$Resources:Thumbnail %>"></asp:Literal> <em id="Em4" runat="server"></em></asp:Label>
                            <asp:TextBox ID="Thumbnail4" Text="" runat="server" MaxLength="250"></asp:TextBox>
                            <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" AssociatedControls="Thumbnail4" runat="server" cssclass="pickerWrapper" ButtonText="<%$Resources:Select%>" />
                           
                            <p class="example">
                                <asp:Literal ID="Literal27" runat="server" Text="<%$Resources:ThumbnailNote %>"></asp:Literal>
                            </p>
                        </li>
                          <li class="selector">
                            <asp:Label ID="Label12" AssociatedControlID="Thumbnail5" runat="server"><asp:Literal ID="Literal28" runat="server" Text="<%$Resources:Thumbnail %>"></asp:Literal> <em id="Em5" runat="server"></em></asp:Label>
                            <asp:TextBox ID="Thumbnail5" Text="" runat="server" MaxLength="250"></asp:TextBox>
                            <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" AssociatedControls="Thumbnail5" runat="server" cssclass="pickerWrapper" ButtonText="<%$Resources:Select%>" />
                           
                            <p class="example">
                                <asp:Literal ID="Literal29" runat="server" Text="<%$Resources:ThumbnailNote %>"></asp:Literal>
                            </p>
                        </li>
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Feb 2010
    Link to this post
    Hi Gokhan,

    There is a similar problem that applies to the versions before Sitefinity 3.7 SP2 build 2057. Most probably you use an old version. In the older versions there is a problem with the js and the selector cannot find the correct TextBox.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Gokhan
    Gokhan avatar
    32 posts
    Registered:
    11 Jul 2008
    02 Feb 2010
    Link to this post
    Hi Iva;

    You were right, Sp2 fixed that issue. But What i couldnt understand when add these new fields how will they be persisted on database and how i could populate them on Edit page. This will require database alteration i think.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Feb 2010
    Link to this post
    Hi Gokhan,

    If they are metakeys you should add them in NewsItemEdit and NewsItemNew. Note that the Textbox id's should be the same as the names of your metakeys. The metakeys are persisted authomatically, so you should not make any changes to the database or write any client or server side code.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
    Answered
  9. Angel Petrov
    Angel Petrov avatar
    2 posts
    Registered:
    17 Aug 2009
    21 Jan 2011
    Link to this post
    Hi,

    I too have this problem - multiple image selectors on the same page.
    The problem is that it's not an option for my current case to upgrade the version, I have to remain on version 3.6.
    So, my question - isn't there some other "hotfix" that will fix this for my 3.6?
    Or maybe I could write some code somewhere?

    Cheers,
    Angel
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    21 Jan 2011
    Link to this post
    Hi Angel,

    As far as I remember the we did not manage to provide temporarily workaround. What you can try is replacing the files in the directories below

    Sitefinity/Admin/ControlTemplates/Libraries/Dialogs
    Sitefinity/Admin/ControlTemplates/News/Dialogs
    Sitefinity/Admin/ControlTemplates/Pages/Dialogs

    with the files from 3.7 SP4. I am not sure that this will do the trick, but you can try, otherwise you have to upgrade the project.

    Best wishes,
    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
  11. Angel Petrov
    Angel Petrov avatar
    2 posts
    Registered:
    17 Aug 2009
    21 Jan 2011
    Link to this post
    Hi Ivan,

    Thank you for your quick response!
    Unfortunately that did not do the trick. And, my current situation does not permit me to upgrade the version.
    What I'm trying to achieve is to enable the users to add 5 images to a News item, instead of the current one thumbnail. As described above, version 3.6  has this issue of multiple image selectors on the same page.
    Would you possibly have another approach towards achieving my goal?

    Thanks!
    Angel
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Jan 2011
    Link to this post
    Hi,

    You should upgrade the project to 3.7 SP3 or SP4. I do not see an other option here, since we fixed the issue almost an year ago.

    Kind regards,
    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
Register for webinar
12 posts, 1 answered