Pergunta

I'm kind of new to ASP.NET and I would like to know how it's possible to add a Picture on a TableCell. What I am doing is the following :

I have two pictures that Represent Male & Female. I want to load a picture of a male if "sex" = 1 , if it's "2", display the female picture.

Foi útil?

Solução

Easiest way is to just add IMG tag.

cell5.Text = string.Format("<img src='{0}' />", blaa == "1"? "Male.png" : "Female.png");

string.Format will substitute {0} with the second parameter - which will select either male or female based on value of "blaa".

If you use the code as is - you should place the images into the same directory as your ASPX file.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top