Backend link in gridview
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);
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.