p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 (http://p2p.wrox.com/forumdisplay.php?f=228)
-   -   Beginning ASP.NET 2.0 with C# - Chapter09 pg 295 (http://p2p.wrox.com/showthread.php?t=47286)

tbroom September 1st, 2006 02:08 PM

Beginning ASP.NET 2.0 with C# - Chapter09 pg 295
Beginning ASP.NET 2.0 with C# - Chapter09 pg 295

Try it out: Step 4: Double-click the button to create the code-behind file and the button click event

This is done and I am getting:
Partial Class SimpleTypes
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

    End Sub
End Class

When I look the END Chapter09 SimpleTypes.aspx.cs file I am seeing something like this:
using System;

partial class SimpleTypes : System.Web.UI.Page
    protected void Button1_Click(object sender, System.EventArgs e)
        Label1.Text = TextBox1.Text + TextBox2.Text;
        Label2.Text = DateTime.Parse(TextBox3.Text).ToString("dd MMM yyyy");
        Label3.Text = DateTime.Parse(TextBox3.Text).ToString();

What is causing me to see something completely different?

Also I noticed that when the button was added and I compared it to the file in the END Chapter09 directory they were not the same

I had in my SimpleTypes.aspx file:
<asp:Button ID="Button1" runat="server" Text="Button" /></div>

END Chapter09: had in its file SimpleTypes.aspx
 <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></div>

Should there not be a step indicating one needs to add an Event to the button selecting the action “Click” and adding “Button1_Click”?

RobC September 1st, 2006 02:35 PM

Your code behind file is in VB.[:0]

Try recreating the page and specifying C#.

All times are GMT -4. The time now is 10:20 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.