Reputation: 35475
I am storing small webpages in html format in a varchar(max) column in MS SQL server 2008. Now I want the gridview to show the column as a button/hyperlink such that when I click it, I will be redirected to a new webpage which will render the html in the table corresponding to that row.
I tried using the buttonfield control but there doesn't seem to be any way I can access the datafield and underlying html in that case. Any ideas, peeps?
Upvotes: 0
Views: 299
Reputation: 13706
Make the link to point to somepage.aspx?id=xxx
, where xxx is id of the row that contains the required html. In somepage.aspx
in Page_Load
event read teh html from sql server and write it to the client.
Something like this:
<asp:TemplateField HeaderText="">
<ItemTemplate>
<a href="mypage.aspx?id=<%# Eval("ID") %>">View</a>
</ItemTemplate>
</asp:TemplateField>
Upvotes: 1