Please help me to show image in gridView when image source is defined in datatable?

The GridView control automatically html-encodes everything, but there are a couple ways you can turn it off. If you have the image field declared in the aspx page, the easiest option is to just set the HtmlEncode property to false.

Up vote 0 down vote favorite 1 share g+ share fb share tw.

I have got a datatable in witch I have got image url. I don't want to create a tamplet column. I just want to assign my datatable as datasource of gridview and it should show image in its field like: dim dt as new datatable dr = dt.

NewRow dr("HotelName") = "citypalace" dr("image") ="" 'but this is not working its showing url in that column... dt.rows. Add(dr) gridview1. Datasource = dt gridview1.databind() please give me solution that what should I do with that column of datatable so it will show image in gridview.

(please don't say me to create a template column). Asp.net image gridview datatable link|improve this question asked Dec 31 '09 at 6:50Rajesh Rolen- DotNet Developer2,91021248 97% accept rate.

The GridView control automatically html-encodes everything, but there are a couple ways you can turn it off. If you have the image field declared in the aspx page, the easiest option is to just set the HtmlEncode property to false. If this isn't feasible in your case, you can 'undo' the html encoding for these cells on the GridView's RowDataBound event.

Private Sub gridview1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls. GridViewRowEventArgs) Handles gridview1. RowDataBound e.Row.

Cells(1). Text = Server. HtmlDecode(e.Row.

Cells(1). Text) End Sub I'm assuming from your example that your GridView has 2 columns and the image column is the second one, hence Cells(1) in each row. Hope this helps!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions