Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys,

Can somebody tell me how to set html table background image programatically in asp.net.

I have set my table as runat="server".
And trying this code -
C#
tableid.Style.Add("background-image", "url('../App_Themes/DeviceImages/image.gif')");

But this is not working.

Thanks in advance.
Posted
Updated 9-Jan-12 1:36am
v3

It should work. Just check your image path. Or try to resolve path using Page.ResolveUrl method.
 
Share this answer
 
Comments
leonidasvijay 9-Jan-12 7:45am    
I have already use page.resolve url and server.mappath.
Both are not working.
Suresh Suthar 9-Jan-12 7:48am    
Is image available there at your given path? Use developer tool i.e. FireBug for inspecting that element. What is it showing? Check the path in webbrowser.
Try urls as
try this answer

hope one of the url works.......
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900