Dynamic ImageButton doesn't show image on Mozilla Firefox

By ·
Hi All,

I have created a wizard control. I have created two ImageButtons dynamically for a particular wizard step.

For IE6 it looks and works fine.

For IE7 it also looks and works fine by adding my website as trusted website.

But the issue is

For Mozilla Firefox 3.0.4, image is not displayed. Instead a text named "Submit Query" is displayed. And the Click event for those ImageButtons is not working.

If adding my website as trusted as in the case for IE7 will solve my problem, then how can i add it for Mozilla Firefox.

If not, Please let me know how can this issue be resolved.

Many Thanks.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

You need to look at the HTML Code

by OH Smeg Moderator In reply to Dynamic ImageButton doesn ...

And remove the errors in it. IE is much more forgiving or poor coding or errors than FF is. That is why things may work strangely in IE and work or not work at all in FF. IE will make Guesses as to what was intended while FF will just Halt on any error and spit the dummy.

Works a treat when you stuff up sometimes but it can also cause the wrong thing to happen as well.


Collapse -

Re:Dynamic ImageButton doesn't show image on Mozilla Firefox

Basically the problem is regarding the image path you have given. Please try the below code in your page:

protected void Page_Load(object sender, EventArgs e)
ImageButton imgbtn = new ImageButton();
imgbtn.ImageUrl = "~\\Images\\Save.gif";
imgbtn.AlternateText = "Save";
imgbtn.Click += new ImageClickEventHandler(this.imgbtn_Click);

protected void imgbtn_Click(object sender, ImageClickEventArgs e)
ImageButton imgbtn = (ImageButton)sender;
imgbtn.ImageUrl = "~\\Images\\cal.gif";
imgbtn.AlternateText = "Calender";

If the line imgbtn.ImageUrl = "~\\Images\\Save.gif"; is replaced by imgbtn.ImageUrl = "Images\\Save.gif"; your problm will be reconstructed.
Renjith Balakrishnan
Aspire Systems|Chennai

Related Discussions

Related Forums