<html>
<head>
<title>C# Primer: Conditional ? : Operator</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
void Page_Load ( Object sender, EventArgs e ) {
// initialize link text
if ( !IsPostBack ) {
showhideLink.InnerText = image.Visible ? "Hide Image" : "Show Image";
}
}
void ShowHideImage ( Object Src, EventArgs E ) {
image.Visible = image.Visible ? false : true;
showhideLink.InnerText = image.Visible ? "Hide Image" : "Show Image";
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2>C# Primer: <span class="hilite">Conditional ? : Operator</span></h2></div>
<hr size=1 width=92%>
<div align="center">
<p><a id="showhideLink" runat="server" onServerClick="ShowHideImage" />
<p><img id="image" runat="server"
src="/shared/images/earth.gif"
width="100" height="100" border=0
alt="Save our Planet" visible=false />
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>