asp.net anchor tag passing query string to a different site

Kity Pompa asked on March 19, 2015 15:40

I have a homepage in Kentico 8. On the page, there is a NoticeRepeater which a transformation of type ascx. In the transformation, there is an anchor tag link to external site with markup like: The customers sometimes are directed to the homepage with a querystring called e_code. If they do, I want the anchor to pass the query string to the external site. Our company is new to Kentico, and I tried to search online and read the developer doc etc. I have also tried different solutions,could not get it to work. Basically, something like the following. What did i do wrong? please help, thanks. {% if(QueryString.GetValue("e_code") == null){
}else{ <a href="http://someothersite.com?e-code="+QueryString.GetValue("e_code")+" class="btn btn-lg btn-icon-right"> } %}

Recent Answers


Brenden Kehren answered on March 19, 2015 19:55 (last edited on December 10, 2019 02:30)

Looks like your syntax is incorrect

{% if(QueryString.GetValue("e_code") == null){""}else{ "<a href='http://someothersite.com?e-code="+QueryString.GetValue("e_code")+" class='btn btn-lg btn-icon-right'>" } |(identity)GlobalAdministrator%}

You're building a string so you need to either escape the double quotes or use single quotes.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.