Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all,

I have added a background image to ajax tab body in CSS but doesn't know why the image doesn't appear when I run the program. I have already added the cssstyle to ajax tab container. My tab container and tabs are created dynamically in C#, and my image is in 'Image' folder as 'TabBackground', image is in jpg format.

This is my codes:
C#
//Cs file
 AjaxControlToolkit.TabContainer container = new AjaxControlToolkit.TabContainer();
            container.ID = "TabContainer";
            container.CssClass = "tabstyle";

CSS
/*Css file*/

.tabstyle .ajax__tab_body
{
    background-image:url(Image/TabBackground.jpg);
}

Thanks.
Posted
Comments
Krunal Rohit 20-Oct-15 0:34am    
Use F12 and inspect the tab body. And then try to change the background-color from browser itself.

-KR

1 solution

Try this:
CSS
.tabstyle .ajax__tab_body
{
    background-image:url('Image/TabBackground.jpg') !important;
}


--Amy
 
Share this answer
 
v2
Comments
Member 11999641 19-Oct-15 23:16pm    
hi _Amy, thanks for your reply, have tried this but result is still the same.
_Amy 19-Oct-15 23:18pm    
Is your url correct? Can you recheck that?
Member 11999641 19-Oct-15 23:21pm    
yes is correct, I have set that image as my chart background and it works, in this format:Chart.BackImage = "Image/TabBackground.jpg"; in C#. but not sure why it doesn't work when I try to set that image in css as my tab panel background.
_Amy 19-Oct-15 23:23pm    
Where you placed your tab? Is it in root directory or in some folder?
Member 11999641 19-Oct-15 23:24pm    
my tab is being generated dynamically in C#. Like this: AjaxControlToolkit.TabPanel panel = new AjaxControlToolkit.TabPanel();
panel.HeaderText += item.Text;
container.Tabs.Add(panel);

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