|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Setting background image for gridvew cellHi,
I need to set the background image of the grid view cell according to the data. Is there any way to do this? Thanks, Anup Use the RowDataBound method. Replace the Cell array value and "images/"
path to where your images are really located. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { string imageName = e.Row.Cells[1].Text; e.Row.Cells[1].Attributes.Add("Style", "background-image: url('images/" + imageName + "')"); } HTH. -dl Show quote > Hi, > > I need to set the background image of the grid view cell according to > the data. Is there any way to do this? > > Thanks, > Anup |
|||||||||||||||||||||||