Reputation: 1741
Is it possible to put a button on my user control .ascx
(the web part in this case), and have a customized image with that? What I am trying to do is have a "print" button to print the page.
However, I don't want to use the default asp button, I want to have a the special "print" icon associated with it. So, can I do this and still use <asp:button>
?
Or is it just better to make that "print" icon a link, and do OnClick
on the link event?
Upvotes: 0
Views: 177
Reputation: 17614
You can use link button as suggested.
But in my opinion you should not use any server-side control if you don't have to use it on server side.
What you can do create an image tag <img src....
and use onclick
event on this image.
When you create a server side controls it is added to your view state
key value
pair of information. Which is an overhead.
or you can use like this
<a href="javascript:window.print()">
<img src="print.gif">
</a>
or even
<img src="print.gif" name="pic" onclick="javascript:window.print()"/>
Upvotes: 3
Reputation: 81
Try this:
<asp:ImageButton ID="submitButton" runat="server" OnClick="submitButton_Click" ImageUrl="~/images/printer.jpg" />
Upvotes: 1
Reputation: 34489
You could try the ImageButton class, then you can have a printer icon for example.
Upvotes: 1