Currently I am binding a dataset with a datagrid.
ds = query.ExecuteReadQuery('select PollQuestionText as 'Survey Question', PollAnswer1Text as 'Selection 1', PollAnswer2Text as 'Selection 2', PollAnswer3Text as 'Selection 3', PollEnabled 'Status' from tbl_pollquestions') For Each row As Data.DataRow In ds.Tables(0).Rows If row.ItemArray(4).ToString = '0' Then row.ItemArray.'<a href=''''> <img src=''img/box_icon_edit_pencil1.gif'' border=''0''> </a>' ElseIf row.ItemArray(4).ToString = '1' Then row.Item(4) = '<a href=''''> <img src=''img/box_icon_edit_pencil2.gif'' border=''0''> </a>' End If Next GridView1.DataSource = ds GridView1.DataBind()
Since I am inserting html code, why this is not being converted to html?
The output result is all text. (Suppose an icon is being displayed with no redirect url)
I dont know why.
Thanks
Here’s one quick way to solves your problem without using content template.
First, add
RowDataBoundevent to your GridView.Second, add the code for the event handler using your logic. RowDataBound event will fire for every row, we don’t have to use
foreach. I’m using C# but you can easily convert it to VB.As a side note, you might want to change
to
and set the background image using CSS.