Reputation: 87
What is the correct syntax to the NavigateURL attribute of asp:HyperLink?
Error came when I used double quote characters. (Eg:-Number of "visits accessing our community" health physiotherapy services )
<RAD:GridTemplateColumn HeaderText="KPI" DataField="DisplayName" UniqueName="KPIName" GroupByExpression="DisplayName Group By DisplayName">
<ItemTemplate>
<asp:Label Text='<%# Eval("DisplayName") %>' ID="lblKPI" runat="server" Visible="false" />
<asp:HyperLink runat="server" ID="lnkKpi" rel='<%# Eval("DisplayName") %>' Text='<%# Eval("DisplayName") %>' NavigateUrl='<%# Eval("KPIID","~/Authorised/PerformanceManagement/PerformanceManagement.aspx?Kpi={0}") %>' Target="_blank"></asp:HyperLink>
</ItemTemplate>
</RAD:GridTemplateColumn>
Result
How to handle the error ?
Upvotes: 0
Views: 926
Reputation: 323
You can do it by creating a URL in the code behind file.
See Dynamically set a hyperlink control's NavigateUrl property inline.
Upvotes: 0
Reputation: 35564
Use HtmlEncode
for the values
Text='<%# HttpUtility.HtmlEncode(Eval("DisplayName")) %>'
Or
NavigateUrl='<%# "~/Authorised/PerformanceManagement/PerformanceManagement.aspx?Kpi=" + HttpUtility.HtmlEncode(Eval("DisplayName")) %>'
Upvotes: 1