Reputation:
I am trying to open the new page in the new tab after clicking on the web link, I am using the asp:hyperlink
the hyperlink navigate url
is getting bind in the grid but when I tried to run it throws Server tag not formed
. I have tried using linkbutton
also but could not able to open the link into new tab here is my hyperlink code .
<asp:HyperLink NavigateUrl='<%# String.Format("ViewTask.aspx?TaskID={0}",Helper.GetEncryptedData((Eval('ID').ToString()))) %>' Target="_blank" runat="server" >View</asp:HyperLink>
I have tried using the anchor tag
,Link Button
and Hyperlink
button nothing works.
With anchor tag it opens the link in the new tab but the url is encrypted which gives messed up querystring values on code behind of redirected page with HTML encoded
values in query string.
With LinkButton
i was able to get the write querystring values but not able to open it in the new tab.
And with Hyperlink
it gives above mentioned error.Any help would be great.
Upvotes: 1
Views: 2473
Reputation: 3662
Eval('ID')
should be Eval("ID")
<asp:HyperLink NavigateUrl='<%# String.Format("ViewTask.aspx?TaskID={0}",Helper.GetEncryptedData((Eval("ID").ToString()))) %>' Target="_blank" runat="server" >View</asp:HyperLink>
Upvotes: 2