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

Forums / Developing with Sitefinity / Backend link in gridview

Backend link in gridview

2 posts, 0 answered
  1. Gooya
    Gooya avatar
    23 posts
    Registered:
    11 May 2010
    19 Aug 2013
    Link to this post

    Hello,
    I have one question. I want to create link, which have id in url. So I wrote ClientTemplate and found out that {{fields}} sintax doesn't work in attributes. So I wrote some javascript to overcome the problem.
    Is there a better solution for this?

    01.DataColumnElement exportColumn = new DataColumnElement(gridMode.ColumnsConfig)
    02.           {
    03.               Name = "Id",
    04.               HeaderText = Res.Get<Labels>().Export,
    05.               ClientTemplate = "<span data-id='{{Id}}'><span style='display:none'>{{Id}}</span><a onclick='var $this=$(this); $this.attr('href', $this.attr('href').replace('{{Id}}', $this.parent().children('span:not(:visible)').html() ) )' href='/" + ExportService.BaseUrl + "{{Id}}/ExportApplications'>Export</a>{{Id}}</span>",
    06.               HeaderCssClass = "sfRegular",
    07.               ItemCssClass = "sfRegular"
    08.           };
    09.           gridMode.ColumnsConfig.Add(exportColumn);
  2. Patrick Dunn
    Patrick Dunn avatar
    237 posts
    Registered:
    03 Nov 2014
    21 Aug 2013
    Link to this post
    Hello Mitja,

     Thank you for the sample.

    I couldn't think of a better way personally but I will pass your concern about the syntax in attributes to the development team as a suggestion.

    Regards,
    Patrick Dunn
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered