我有一个数据表的gridview数据绑定。在其中一列中,输入数据的人员放置在他们设施的位置,并在同一单元格中链接到他们的网站。像:
Baltimore, MD <a href="www.location.com">Location</a>
我该怎么做才能将链接读作html?
gridview代码:
<asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="start_date" HeaderText ="Start Date" DataFormatString="{0:d}" HtmlEncode="False" />
<asp:BoundField DataField="end_date" HeaderText ="End Date" DataFormatString="{0:d}" HtmlEncode="False" />
<asp:BoundField DataField="sponsor" HeaderText ="Sponsor" />
<asp:HyperLinkField DataNavigateUrlFields ="sponsor_id"
DataNavigateUrlFormatString="http://www.cdc.gov/niosh/topics/spirometry/sponsors.html#c{0}"
HeaderText ="Sponsor Details"
Text="Details"/>
<asp:BoundField DataField="location" HeaderText ="Location" />
<asp:BoundField DataField="region" HeaderText="Region" />
<asp:BoundField DataField="course_type" HeaderText ="Course Type" />
</Columns>
他们将添加到绑定到位置字段的列。
<Columns>
<asp:BoundField DataField="start_date" HeaderText ="Start Date" DataFormatString="{0:d}" HtmlEncode="False" />
<asp:BoundField DataField="end_date" HeaderText ="End Date" DataFormatString="{0:d}" HtmlEncode="False" />
<asp:BoundField DataField="sponsor" HeaderText ="Sponsor" />
<asp:HyperLinkField DataNavigateUrlFields ="sponsor_id"
DataNavigateUrlFormatString="http://www.cdc.gov/niosh/topics/spirometry/sponsors.html#c{0}"
HeaderText ="Sponsor Details"
Text="Details"/>
<asp:BoundField DataField="location" HeaderText ="Location" HtmlEncode="false" />
<asp:BoundField DataField="region" HeaderText="Region" />
<asp:BoundField DataField="course_type" HeaderText ="Course Type" />
</Columns>
将htmlencode更改为false。