문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top