2012年3月24日土曜日

Rollovers with update panel not working?

Hello all,

I got a master page which containsjavascript generated by imageready for the rollover effect. I have acontent page which contains textbox, image button, updatepanel (Atlas)with Partial Rendering=True and gridview. Everything works fine in thebeginning. But once I sort, filter the grid view, the grid viewchanges as it should but now my rollovers don't work. I seems that thefunction that the onmouseover is not firing. I can still mess with thegridview that works fine. Oh yea the image button also has rolloverstate, that works but that is not calling the imageready function. Ithas inline javascript onmouserover="this.src='imgOver.gif';". I'malittle confused why the functions are not firing after the callback. Any ideas will be appreciated.

Thank YouPhotoshop's generated javascript uses a global boolean variable calledpreloadFlag. It sets this value to false globally, so I guess when a call back happens this line was being executed and sset back to false from being true. So none of the rollovers worked. I set it to true and the roll overs worked.

Hi boricua,

Here's a procedure you can adapt to your needs. Just call it for each ImageButton from the Page_Load. I've only tested this on IE 6, so let me know if it gives you any trouble.

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.LoadIfNot (Page.IsPostBack)Then

rollover3State(imgArrowLeft,

"ArrowLeft")
rollover3State(imgArrowRight,"ArrowRight")EndIfEndSubProtectedSub rollover3State(ByVal btnObjectAs ImageButton,ByVal baseImageAsString)

btnObject.Attributes.Add(

"onmouseout","{this.src='" &Me.ResolveUrl("App_Themes/" &Me.StyleSheetTheme &"/images/btn_" & baseImage &"_0.gif") &"';}")

btnObject.Attributes.Add(

"onmouseover","{this.src='" &Me.ResolveUrl("App_Themes/" &Me.StyleSheetTheme &"/images/btn_" & baseImage &"_1.gif") &"';}")

btnObject.Attributes.Add(

"onmousedown","{this.src='" &Me.ResolveUrl("App_Themes/" &Me.StyleSheetTheme &"/images/btn_" & baseImage &"_2.gif") &"';}")EndSub

Yeah this works. I used this method on some pages that I manually created, but for the ones that the html was created by imageready, which creates the javascript as well I fixed with the method I described earlier thank you dbDan.

0 件のコメント:

コメントを投稿