Hey everyone, I'm extremely new to the world of ASP.NET.  I am
following an online tutorial located here:
http://www.maconstateit.net/tutorials/ASPNET20/default.htm

and am working on this tutorial
http://www.maconstateit.net/tutorials/ASPNET20Assignments/ASPNET02/TheAssignment2-4.aspx

This page is supposed to change the styles of printed text when a
button is pressed.  That works fine.  My question is, when I press the
button again, the text disappears, and I was wondering why?  Theres no
code in there to make the labels (Par and NameOut) not visible or
removes the text.

Enlightenment will be greatly appreciated.  And since I'm very new,
feel free to critique my style, variable names, etc.

Thanks

Justin


Below is my code:

<code>

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>

<%@ Import Namespace=System.Drawing %>

<SCRIPT Runat="Server">

        Sub Display_Name(sender as Object, e as EventArgs)
                If NameIn.Text <> "" Then
                        NameOut.Text = NameIn.Text
                        StyleButton.Visible = True
                Else
                        StyleButton.Visible = False
                End If
        End Sub

        Sub Style_Output(sender as Object, e as EventArgs)
                Par.Font.Bold = True
                Par.ForeColor = Color.FromName("#6600FF")
                NameOut.Font.Bold = True
                NameOut.ForeColor = Color.Fromname("Red")
                NameOut.Font.Size = FontUnit.Parse("14pt")
                NameOut.BackColor = Color.FromName("Yellow")
        End Sub

</SCRIPT>

<html xmlns="http://www.w3.org/1999/xhtml";>

<head>

</head>

<body>
        <form Runat="Server">
                <h2>Dynamic Styles</h2>
                <p>Enter your name:
                <asp:TextBox id="NameIn" Runat="Server" />
                <asp:Button Text="Enter" OnClick="Display_Name" Runat="Server" 
/>
                </p>
                <p><asp:Label id="Par" Runat="Server">
                        Welcome <asp:Label id="NameOut" Runat="Server" /> to my 
Web page.
                </asp:Label>
                </p>
                <p><asp:Button id="StyleButton" Text="Style Output"
OnClick="Style_Output" Visible="False" Runat="Server" />
                </p>
        </form>
</body>

</html>

</code>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/DotNetDevelopment

You may subscribe to group Feeds using a RSS Feed Reader to stay upto date 
using following url  

<a href="http://feeds.feedburner.com/DotNetDevelopment";> 
http://feeds.feedburner.com/DotNetDevelopment</a>
-~----------~----~----~----~------~----~------~--~---

Reply via email to