Example of ImageUrl Property
If you want to use image in place of Text on hyperlink control then you must specify the ImageUrl Property to the Hyperlink control. If you have been set ImageUrl then your Text will be hide because Image priority is high compare to text.Lets take an example
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:HyperLink ID="HyperLink1" runat="server" ImageUrl="~/submit.jpg"
NavigateUrl="Http://www.google.com">HyperLink</asp:HyperLink>
</div>
</form>
</body>
</html>
Output<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:HyperLink ID="HyperLink1" runat="server" ImageUrl="~/submit.jpg"
NavigateUrl="Http://www.google.com">HyperLink</asp:HyperLink>
</div>
</form>
</body>
</html>
Tidak ada komentar:
Posting Komentar