Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2006, 10:02 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default ASP.NEt syntax error

I have built this simple page with ASP.NEt, as I am new to the language. However, the page loads, but i get a 'syntax error' in IE. But when i view source i cant ee any errors? Sorry if i am missing something, just cant see it???


Code:
<%@ Page Language="VB" Debug="True" %>
<script runat="server">

Sub GetFormInfo(o As Object, e As EventArgs)
    theLabel.Text = "Your name is " & Name.text

    if Deutschland.Checked then
        theCtryLabel.Text = "Your favourite country is Deutschland"
    elseif Scotland.Checked then
        theCtryLabel.Text = "Your favourite country is Scotland"
    elseif Canada.Checked then
        theCtryLabel.Text = "Your favourite country is Canada"
    elseif Polska.Checked then
        theCtryLabel.Text = "Your favourite country is Poland"
    end if
End Sub

</script>
<html>
<head>
<link href="style.css" rel="StyleSheet" type="text/css" />
</head>
<body>
    <form runat="server">

        This is a TextBox, Please Enter your Name:
        <asp:TextBox id="Name" runat="server" />
        <br /><br />

        This is a radio button, Please Select Your Country:
        <asp:RadioButton id="Deutschland" GroupName="country" Text="Deutschland" runat="server" />
        <asp:RadioButton id="Scotland" GroupName="country" Text="Scotland" runat="server" />
        <asp:RadioButton id="Canada" GroupName="country" Text="Canada" runat="server" />
        <asp:RadioButton id="Polska" GroupName="country" Text="Polska" runat="server" />
        <br /><br />

        This is a DropDown List, Please Select Your Favourite Jamaican Football Team:
        <asp:DropDownList id="drop" runat="server">
            <asp:ListItem>Arnett Gardens FC</asp:ListItem>
            <asp:ListItem>Constant Spring FC</asp:ListItem>
            <asp:ListItem>Reno FC</asp:ListItem>
            <asp:ListItem>Waterhouse FC</asp:ListItem>
        </asp:DropDownList>
        <br /><br />

        This is a list, please Select your Favourite city:

        <asp:ListBox runat="server" id="List">
            <asp:ListItem>Munchen</asp:ListItem>
            <asp:ListItem>Koln</asp:ListItem>
            <asp:ListItem>Bremen</asp:ListItem>
            <asp:ListItem>Hannover</asp:ListItem>
            <asp:ListItem>Stuttgart</asp:ListItem>
        </asp:ListBox>
        <br /><br />

        This is a link, CLICK IT!
        <asp:HyperLink id="hyperhyper" onClick="http://www.crmpicco.co.uk" runat="server" />
        <br /><br />

        This is a button, Click it to Submit the Form:
        <asp:Button id="Submit" text="Submit" onClick="GetFormInfo" onMouseOver="style.cursor='pointer'" runat="server" />
<br /><br />
        <asp:Label id="theLabel" runat="server" style="border: 2px solid; border-color: #000000; width: 300px;" />
        <br />

        <asp:Label id="theCtryLabel" runat="server" />
    </form>
</body>
</html>

www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old July 7th, 2006, 10:38 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

What is the error and on what line of code?

 
Old July 16th, 2006, 11:45 PM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
Default

crmpicco:
On click is not an available event handler for an asp.hyperlink.
On mouse over is not an available event handler for an asp.button.
VV


 
Old December 1st, 2006, 08:25 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks, is there a way to have a onMouseOver in a .aspx page then?

www.crmpicco.co.uk
www.ie7.com
 
Old December 1st, 2006, 08:36 AM
Authorized User
 
Join Date: Sep 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, use "onclientclick" method of servercontrol to inject clientside code.
For hyperlink to work use "NavigateUrl"property adn give url path.


 
Old December 7th, 2006, 12:54 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

would this work?
Code:
<asp:button id="Button1"
       usesubmitbehavior="true"
       text="Open Web site"
       onclientclick="style.cursor='pointer'"
       runat="server" onclick="Button1_Click" />
www.crmpicco.co.uk
www.ie7.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error in FROM clause: asp jpindi ASP.NET 1.0 and 1.1 Basics 6 July 16th, 2008 12:30 AM
asp help for newbie syntax error jennypretty Classic ASP Basics 2 June 1st, 2007 01:08 PM
Syntax error for chapter 15 AddUser.asp gymmic Classic ASP Databases 7 April 20th, 2004 02:00 AM





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