CodeVerge.Net Beta
Login Idy
Register Password
  Forgot?
Explore    Item Entry    Members   
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 4/16/2007 6:31:56 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 13 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
bcanonica
Asp.Net User
ImageButton RollOver on MasterPage???4/16/2007 6:31:56 PM

0/0

Trying create a simple image rollerover with an imagebutton in a panel on a masterPage.  OnMouseOver Change Image and OnMouseOut change image back to original image.  This seems complicated.  Research has pointed me in a couple different directions that I don't think work.  And neither seems to work.  If someone could point me in the right direction I would appreciate it. 

 1.  

"ibImage" ImageUrl="~/b.jpg" runat="server">

[...]

protected void Page_Load(object sender, EventArgs e)
{
ibImage.Attributes.Add("onmouseover", "this.src='s.jpg'");
ibImage.Attributes.Add("onmouseout", "this.src='b.jpg'");
}
 2.   
        "server"
            ImageUrl="images/banana.jpg"
            BorderWidth="0.2cm"
            BorderColor="Gainsboro"
            onmouseover="this.src='images/mango.jpg';"
            onmouseout="this.src='images/banana.jpg';"
            onclick="Button3_Click">
 BC
 


cheers,

BC

"Every great man is always being helped by everybody; for his gift is to get good out of all things and all persons."

By John Ruskin
MorningZ
Asp.Net User
Re: ImageButton RollOver on MasterPage???4/17/2007 12:26:08 PM

0/0

perhaps try

ibImage.Attributes.Add("onmouseover", "this.src='/images/s.jpg'");
ibImage.Attributes.Add("onmouseout", "this.src='/images/b.jpg'");

as in the two code samples above you are mixing:  no paths, using the ~, and relative pathing

it's just easier to use virtual pathing, which doesn't involve the .NET engine at all, so that your generated HTML always knows where to go.....


"If you make it idiot proof, they'll build a better idiot"
bcanonica
Asp.Net User
Re: ImageButton RollOver on MasterPage???4/17/2007 2:13:53 PM

0/0

I have tried removing ~ and / and vice versa.  The mouse over event is definetely firing.  Like you said it just seems to be a problem with my path.  works fine in examples on the web like below, but haven't been able to get it to work in VS2005.  Is this a VS2005 thing and will work or what?

 

http://quickstart.developerfusion.co.uk/QuickStart/util/srcview.aspx?path=~/aspnet/samples/ctrlref/standard/ImageButton/ImageButton3.src


cheers,

BC

"Every great man is always being helped by everybody; for his gift is to get good out of all things and all persons."

By John Ruskin
MorningZ
Asp.Net User
Re: ImageButton RollOver on MasterPage???4/17/2007 2:40:20 PM

0/0

Might seem silly to check, but:

1) Have you looked at the generated HTML to make sure the attributes did indeed get added?

 2) Have you tried to put something like an "alert()" statement in there instead of changing the src?


"If you make it idiot proof, they'll build a better idiot"
Zhao Ji Ma - MS
Asp.Net User
Re: ImageButton RollOver on MasterPage???4/18/2007 9:56:49 AM

0/0

Hi,

It works great for me:

..

        <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/1.JPG" /></div>

 ...

    protected void Page_Load(object sender, EventArgs e)

    {

        ImageButton1.Attributes.Add("onmouseover", "this.src='Images/2.JPG'");

        ImageButton1.Attributes.Add("onmouseout", "this.src='Images/1.JPG'");

 

    }

The Image files are under Images/ folder in my example. Please check this.

 


Zhao Ji Ma
Sincerely,
Microsoft Online Community Support

?Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ?
5 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

The OpenReport action was Cancelled - microsoft.public.access.queries ... The OpenReport action was Cancelled, > ROOT > NEWSGROUP > Microsoft News > microsoft.public.access.queries, Date: 2 ... imagebutton rollover on masterpage? ...
CodeProject: Enhanced ASP.NET ImageButton Custom Control with Roll-Over ... ... toolkit's ImageButton control is extended to support roll-over effects. ... If I add an image button on the masterpage and have it navigate to NewPage.aspx ...
TheMSsForum.com >> Asp >> changing asp:button text on rollover - The ... ... "server"> <LayoutTemplate> <asp:ImageButton ID="btnNewRow" runat="server" ... I've got a MasterPage,master, as SubMaster.master, and a DesignTime.master, and ...
Arise and walk! — insite.phillfox.net The ASP:ImageButton is better, but it requires that I (or someone) make images ... I can use CSS to make rollover and hover states, use what ever text I'd like. ...
The OpenReport action was Cancelled - microsoft.public.access.queries ... The OpenReport action was Cancelled, > ROOT > NEWSGROUP > Microsoft News > microsoft.public.access.queries, Date: 2 ... imagebutton rollover on masterpage? ...
Recursos web " 2007 " Junio ... un MasterPage, el cual tiene un campo de texto y un ImageButton para efectuar ... on(release) ... Control de servidor RollOver para ASP.NET ...
ASP Net [Archive] - Page 248 Image Rollovers with the Hyperlink Control. Close ... MasterPage setting in web.config - Design Error ... mouseover effect on asp:imagebutton - is it possible ...
TheMSsForum.com >> VB >> Archive Page 57 - The Microsoft Software Forum 19933: Masterpage insert record problem. 19934: How to hide one column in datagrid? ... 19941: can you add onMouseOver/onMouseOut to an ImageButton? ...
How to get DocTitle from aspx master pages ? MasterPage setting in web.config - Design Error ... ImageButton display problem. Extract image dimensions (height, width) from Base64 String? ...
.NET ASP Page 64 - Bytes Site Map mouseover effect on asp:imagebutton - is it possible. Problems using Directories ... ContentPlaceHolderID not found in the MasterPage ...



user control libraries - interesting use of generics and proxy user controls

problems with security and access to protected files

customizing the required data to register in my website.

where in code is the editable setting for modules?

affiliate referrals

how to add items of the user

problems with enabling iis to delegate requests to remote resoureces

authorization question/confusion. i

need help using session state to track user names

in my web application folder i can't find the webctrl_client where i can copy the runtime folder to

html editor raises exception

file manager and links/document modules do not agree on document root

an easy skin css-mozilla-netscape skin question (i hope)

div scrolling in vs 2008

extending user attributes in the database

vs2003 coexists with vwd2005express?

parser error-unable to load type **.global

formsauthentication.signout()

is there a provider for email notifications ?

re: using multiple sitemaps

 
All Times Are GMT