I am new to programming. I have created a GridView and used SqlDataSource to bind. Grid presents several variables from SQL Server database, including hypertext links.
For a particular field I need to: - evaluate a database field "Journal_title" - insert that into a TemplateField.NavigateUrl as part of a longer string - hide the link if another field ("Indexed_NIH") is NULL
The syntax for the string is correct, and works if I insert a single title, but I need to read all titles from the database and insert them into the URL.
My current code successfully displays the link text in appropriate records (i.e. when "Indexed_NIH != NULL), but the NavigateUrl is not displaying correctly.
Any suggestions welcome - please remember that I am new to this!
<asp:TemplateField HeaderText="PubMed">
<ItemTemplate>
<asp:HyperLink ID="lnkPubMed" runat="server" Text="S" Target="_blank" NavigateUrl='http://www.ncbi.nlm.nih.gov/pubmed?term="<%# Eval("Journal_title") %>"[Journal]) AND ("last 3 years" [PDat])"' Visible='<%# Convert.ToString(Eval("Indexed_NIH")) == "True" ? true : false %>' >
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
Nothing in codebehind.