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

Forums / Developing with Sitefinity / Button Selector for LinksDialog.aspx

Button Selector for LinksDialog.aspx

5 posts, 0 answered
  1. Steven Reid
    Steven Reid avatar
    16 posts
    Registered:
    27 Jan 2010
    09 Mar 2010
    Link to this post
    Good morning.
    I am currently trying to improve the UI for my Module. I want the user to enter a URL and be able to select a current page or external URL . The  LinksDialog.aspx is perfect.

    I have taken existing sample code for selecting  an image

     <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx" AssociatedControls="productImage" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" runat="server" cssclass="pickerWrapper" ButtonText="Select Image" />

    and changed it to the links dialog like so

    sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/LinksDialog.aspx"
                                    AssociatedControls="bannerHyperlink" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx"
                                    runat="server" cssclass="pickerWrapper" ButtonText="Select Page" />

    The dialog opens and works fine , except on opening I get a "nodeName" is null or not an object error .  Am I missing a query string parameter ?

    Cheers

    Steven
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Mar 2010
    Link to this post
    Hi Steven Reid,

    The problem is in the js code of the ButtonSelector. The control is supposed to work with items from Images and Documents module. You can use PageSelector instead as suggested in this post. Use the code that I have supplied there. Note that the selector will return dynamic link that you can resolve later - Resolving dynamic links

    Greetings,
    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.
  3. Steven Reid
    Steven Reid avatar
    16 posts
    Registered:
    27 Jan 2010
    09 Mar 2010
    Link to this post
    Ivan ,

    I have change my code to use page selector , but it does not allow external links. I can probably get by with this as I am sure that my customer will mainly be linking to pages within the site.

    However, on closing the control I get an "argument.attributes.sfref" is null or not an object error.

    Do I have to write some Javascript around the control rather than just using a button selector like:

         <sfLib:ButtonSelector 
                WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/PagesSelector.aspx"
                AssociatedControls="bannerHyperlink"     
                ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx"
                runat="server" 
                cssclass="pickerWrapper" 
                ButtonText="Select Page" />

    Cheers

    Steven
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Mar 2010
    Link to this post
    Hello Steven Reid,

    You cannot get null exception because in the sample there is the following if

    if (sender.argument.attributes && sender.argument.attributes["sfref"] != undefined)

    as you can see from the js both cases for null are escaped, so the code should not reach
    sender.argument.attributes["sfref"]. It should step in

    sender.argument["src"] != null && sender.argument["src"] != undefined

    becase the argument is "src" when you work with PagesSelector. The external pages are added as items to the tree of PagesSelector so you can get their Url.

    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.
  5. Steven Reid
    Steven Reid avatar
    16 posts
    Registered:
    27 Jan 2010
    09 Mar 2010
    Link to this post
    Ivan ,
    I have not written any Javascript I have just created a button selector and pointed it at the pages selector.

    It is the elseif in this line of code  which errors:

     if (sender.argument.unresolved) {
                    unresolved = sender.argument.unresolved;
                }
                else if (sender.argument.attributes["sfref"] != undefined) {
                    unresolved = sender.argument.attributes["sfref"].value;
                }


    in the  "OnClientClose(sender, eventArgs) " function.

    Cheers

    Steven
Register for webinar
5 posts, 0 answered