Asp.Net Coding

Only available on StudyMode
  • Topic: Void type, Return statement, Class
  • Pages : 8 (1016 words )
  • Download(s) : 43
  • Published : April 15, 2013
Open Document
Text Preview
CHAPTER 2
OBJECT: Adding Web Forms with Code to Your Site
CODE: public partial class Demos_CodeBehind : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "Hello World; the time is now " + DateTime.Now.ToString(); }
}
OUTPUT:

OBJECT: Adding Formatted Text
CODE: <div class="style1">

<h1 class="style2">
hi there Visitor and Welcome to planet wrox</h1>
</div>
<div>
<h1>Hi there visitor and welcome to Planet Wrox</h1> <p>
We're glad you're <span class="style1">paying a visit</span> to <a href="http://www.PlanetWrox.com">www.PlanetWrox.com</a>, the coolest music community site on the Internet.

</p>
<p>
Feel free to have a look around; there are lots of interesting <strong>reviews and concert pictures</strong> to be found here.
</p>
</div>
OUTPUT:

OBJECT: Using the Format and Table Menus
CODE: <div>

<table class="style1">
<tr>
<td class="style2">
Bulleted Lists</td>
<td>
<ul>
<li>Indie Rock</li>
<li>Techno</li>
<li>Punk</li>
</ul>
</td>
</tr>
<tr>
<td class="style2">
Numbered list</td>
<td>
<ol>
<li>Jazz</li>
<li>HipHop</li>
<li>Rock</li>
</ol>
</td>
</tr>
<tr>
<td class="style2">
link</td>
<td>
<a href="Init.aspx">welcome to planet wrox site</a></td> </tr>
</table>

</div>

OUTPUT:

CHAPTER 3 OBJECT: Writing Your First CSS
CODE: <body style="background-color: #FFFFFF">
<form id="form1" runat="server">
<div>
<h1>Welcome to this CSS Demo page</h1>
<p>CSS makes it super easy to style your pages.</p> <p class="RightAligned">With very little code, you can quickly change the looks of a page. </p> </div>
</form>
</body>

OUTPUT:

CHAPTER 4 OBJECT: Working with Server Controls
CODE: div style="background-color: #FFFFFF">Your name
<asp:TextBox ID="YourName" runat="server"></asp:TextBox> <asp:Button ID="SubmitButton" runat="server" Text="Submit Information" onclick="SubmitButton_Click" /> <br />

<asp:Label ID="Label1" runat="server"></asp:Label> </div>
IN CS:
public partial class Demos_ControlsDemo : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void SubmitButton_Click(object sender, EventArgs e) {
Label1.Text = "Your name is " + YourName.Text;
}
}
OUTPUT:

OBJECT: Working with List Controls
CODE: protected void Button1_Click(object sender, EventArgs e) {
Label1.Text = "In the DDL you selected " +
DropDownList1.SelectedValue + "<br />";
foreach (ListItem item in CheckBoxList1.Items)
{
if (item.Selected == true)
{
Label1.Text += "In the CBL you selected " + item.Value + "<br />"; }
}
}
OUTPUT:

OBJECT: Using the Panel Control & Using the Wizard to Create Easy-to-Use...
tracking img