开发者

Need to display 2 diff banner sprites on same page based on the value of a control of Master Page

there's a label control on the master page..if its value is "Value1" ,I want this CSS Sprite to display on my webform..if the Value is "Value2"..the CSS sprite should use some different image..just the image needs to be changed ..nothing else in that Sprite..开发者_如何学Go

I found out that I can use "FindControl" method to find out what value that Label Control of Master Page's currently got..

Now how do I change that image on the banner ?? How do I go about it ? Also that CSS Sprite now is a user control named "myBanner.ascx"(earlier was an aspx file)..Now do I need to make 2 diff usercontrols or I can implement some logic in one usercontrol itself ?

Should I make 2 copies of this "myBanner.ascx" with JUST the "image name" changed in its CSS ???

Hope its not confusing..Actually I am lost :/

What I want is ONE banner which has been made using CSS Sprite ..Now if the "Label Control's "value in the master page is "Value1" then the image to be used on that banner is "IMAGE1" else if "Label Control's" value is "Value2" then "IMAGE2" should be used in that sprite..

How do I go about it ? Need just ideas..thnx


First of all, use only one usercontrol.

Inside your user control you can add a string variable with the image path.

Then on your control that have this image just overwrite the css style by using the

style="background-image:url(imagePathFromVarible)"

When you declare your usercontrol on the page, change the image path ether by programming, ether on declare...

I hope that I am understandable... if not please tell me to give you some more infos.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜