Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

button as image

Status
Not open for further replies.

ecalbert

Programmer
Dec 25, 2004
61
IL
how can I change a button to show an image

<asp:button id="Button" runat="server" Width="121px" Text="Test"></asp:button>


should still be a button but show an image that i set.
what is the correct code for this?
 
Code:
<asp:ImageButton id="imgHome" runat="server" ImageUrl="images/home.gif" CausesValidation="False"
></asp:ImageButton>

here's a button that I use...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
that caused an error and I have no idea why.

This is my first time using asp.net
 
I wish I knew.
This is my first asp application and I don't know how to se errors.

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
 
how do I change it???

It's currently set as follows

<!-- CUSTOM ERROR MESSAGES
Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
Add <error> tags for each of the errors you want to handle.

"On" Always display custom (friendly) messages.
"Off" Always display detailed ASP.NET error information.
"RemoteOnly" Display custom (friendly) messages only to users not running
on the local Web server. This setting is recommended for security purposes, so
that you do not display application detail information to remote clients.
-->
<customErrors mode="RemoteOnly" />
 
<customErrors mode="Off" />

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
instead of...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
ok the error is
Parser Error Message: The base class includes the field 'TranslateButton', but its type (System.Web.UI.WebControls.Button) is not compatible with the type of control (System.Web.UI.WebControls.ImageButton).

the original code with a button working is

<asp:button id="TranslateButton" runat="server" Width="121px" Text="Translate">
</asp:button>

so I used the same id. what am I doing wrong?
 
i would delete the button and recreate the image button with a new name...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
what do you mean? just to change the name of the image.

Why would that make any difference?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top