More in this section

Forums / Developing with Sitefinity / Issue with hyperlink in custom metafield in news section

Issue with hyperlink in custom metafield in news section

4 posts, 0 answered
  1. Anuj
    Anuj avatar
    13 posts
    Registered:
    12 Dec 2008
    16 Dec 2008
    Link to this post

    We have added Custom Meta Field in news section in Sitefinity version 3.5 SP1 but following hyperlink control is not working properly in my application.

    <asp:HyperLink ID="ProjectURL" runat="server" NavigateUrl='<% = this.Text %>'></asp:HyperLink>

    In above hyperlink text property is showing  as we have entered from admin section but it is not showing proper navigate URL (we want same navigate URL as text).
    I think above Hyperlink is not evaluating as in text field (NavigateUrl='<% = this.Text %>).properly
    this is showing link as (%3C%25%20=%20this.Text%20%25%3E)

  2. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    16 Dec 2008
    Link to this post
    Hi Anuj,

    Thank you for contacting with us.

    Normally Sitefinity will work only with IText based properties to which will assign the metakey values.

    But you can use this tool : http://blogs.sitefinity.com/Ivan/Posts/08-07-03/MetaMaster_2008_-_finally_released.aspx.  It allows you to set mapping to every control and property in the template:

    Follow the steps 1 to 4 in the specified link. In step 4 you must add mapping to NavigateUrl property:
    <cc1:MetaMaster ID="MetaMaster1" runat="server">       
        <Mappings>      
            <cc1:MetaMapping MetaKey="ProjectURL" TargetControlId="ProjectURL"          
                             TargetProperty="NavigateUrl" />      
        </Mappings>      
    </cc1:MetaMaster>    
     

    I hope this will fix the problem.

    Regards,
    Parvan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Anuj
    Anuj avatar
    13 posts
    Registered:
    12 Dec 2008
    17 Dec 2008
    Link to this post
    I am not able to understand this solution i.e "MetaMaster_2008" for adding Custom Meta Field in news section in Sitefinity version 3.5 SP1

    I want to explain my problem once again

    We have added Custom Meta Field in news section in Sitefinity version 3.5 for making hyperlink but following hyperlink control's navigate URL is not working properly in my application.

    <asp:HyperLink ID="ProjectURL" runat="server" NavigateUrl='<% = this.Text %>'></asp:HyperLink>

    We are using it in "ListPageMaster.ascx" control. We have seen in your document that hyperlink control's Navigate URL has been used so it should work

    So what is use of NavigateUrl='<% = this.Text %>' please explain, and how can we use that ?

  4. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    18 Dec 2008
    Link to this post
    Hi Anuj,


    In <%= this.Text %> expression this is not related to the Hyperlink, but to Page( Control) to which it belongs. Such expressions are possible in Javascript: <a href="this.href = this.innerHTML" >textasfaf</a>.

    MetaMaster2008 solution is described here ( http://blogs.sitefinity.com/Ivan/Posts/08-07-03/MetaMaster_2008_-_finally_released.aspx ) in several steps, but it is suitable for Single Items templates (which do not display lists, but single item).

    We found for you another solution for ListPageMaster.ascx. Moreover it will set NavigateUrl of all your HyperLinks with ID="ProjectURL" to be equal to its Text Property(implemented in the attached file).

    1. Open [your site]/App_Browsers/BrowserFile.browser and edit it (change only yellow line):
    <?xml version='1.0' encoding='utf-8'?>  
    <browsers> 
      <browser refID="Default">  
        <controlAdapters> 
          <adapter controlType="System.Web.UI.HtmlControls.HtmlForm" adapterType="Telerik.Cms.Web.FormAdapter, Telerik.Cms" /> 
          <adapter controlType="System.Web.UI.WebControls.RadioButtonList" adapterType="Telerik.Cms.Web.UI.Adapters.RadioButtonListAdapter" /> 
          <adapter controlType="System.Web.UI.WebControls.HyperLink" adapterType="CustomAdapters.CustomHyperlinkAdapter, App_code" /> 
        </controlAdapters> 
      </browser> 
    ....  
    </browsers> 

    2. Add file CustomHyperlinkAdapter.cs (attached in zip) to [your site]/App_Code folder of your web site

    Hope this will help you.

    All the best,
    Parvan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered