Control over Link Text in Hyperlink Manager

2 posts, 0 answers
  1. Marco
    Marco avatar
    22 posts
    Member since:
    Jan 2009

    Posted 24 Aug 2009 Link to this post

    I need some help getting the LinkText set;

    I'm trying to create a product selector that returns a hyperlink. I've created my own content provider, based on the ProductBrowserContentProvider. It's shows a list of products whom I generate in the ResolveDirectroy function shown in the code below. This works quit nice.
    What is returned is a link to my product. It shows the link in the HyperLink Manager window, in both the URL and the LinkText fields.
    But I would like to show the productname in the Linktext. 

            public override DirectoryItem ResolveDirectory(string path) 
                // category 
                DirectoryItem[] directories = GetChildDirectories(path); 
                return new DirectoryItem(GetName(path), EndWithSlash(GetDirectoryPath(path)), path, "", _permissions, GetChildFiles(path), directories); 
            private FileItem[] GetChildFiles(string path) 
                List<FileItem> products = new List<FileItem>(); 
                long categoryid = GetLastIdFromPath(path); 
                if (categoryid > 0) 
                    ProductFilter filter = new ProductFilter(0); 
                    filter.Category = CategoryManager.FindCategory(categoryid); 
                    foreach (Product product in ProductManager.FindProducts(filter)) 
                        string url = "http://${baseurl}/productdetails.aspx?id="
                        url += product.ProductID.ToString(); 
                        url += "&username=${username}&password=${password}"
                        // the linktext should be product.TitleActiveLanguage 
                        FileItem product_item = new FileItem(product.GetTitle(Framework.ActiveLanguage, truetruefalsefalse),"", 0, "location", url, product.TitleActiveLanguage, _permissions); 
                return products.ToArray(); 

    Is it at all possible to control the link text from something inside a FileItem object?
    If not, what do I do to get the linktext to show what I want?


  2. Lini
    Lini avatar
    2144 posts

    Posted 27 Aug 2009 Link to this post

    Hi Marco,

    You can try customizing the DocumentManager.ascx ( control and writing some custom JavaScript code to populate the link text textbox.

    In the DocumentManager.ascx, modify the _setLinkManagerItem() function and in addition to setting the link.href attribute to item.get_url(), set link.innerHTML to the product name - item.get_name().

    All the best,
    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.
Back to Top