Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 1.1
This is the forum to discuss the Wrox book Beginning ASP.NET 1.1 with Visual C#.NET 2003 by Chris Ullman, John Kauffman, Chris Hart, Dave Sussman, Daniel Maharry; ISBN: 9780764557088
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.1 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 September 8th, 2005, 12:20 PM
Registered User
 
Join Date: Sep 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Question about example in ASP.net 1.1

I can't seem to get the <asp:radiobuttonlist> control example to work.

The VS editor underlines the ID part of the <asp:listitem>. Only two default properties are displayed value and selected.


This statement is underlined <asp:listItem and the error message is :

"Within a server element asp:listItem is missing closing tag or ooverlaps with element "RadioButtonList"

And the ID element is underlined, it's error message is "Could not find attribute "id" of element ListItem.

Here is my code:




<%@ Page Language="vb" %>

<script runat="server" language="vb">
Sub Page_Load()
if Page.IsPostBack then
Message.Text = "You have selected " + radCity.SelectedItem.Value
end if
End Sub
</script>

<HTML>
<HEAD>
<title>TIO_RadioButtonList</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<asp:label id="message" Runat="Server" />
<br /><br />
Which city interests you? <br /><br />
<form runat="server">
<asp:RadioButtonList ID ="radCity" Runat="server">
<asp:listItem id = "optMadrid" runat="server" value="Madrid " />
<asp:ListItem id ="optOslo" runat="server" value="Oslo" />
<asp:ListItem id ="optLisbon" runat="server" value="Lisbon" />

</asp:RadioButtonList><br />

<INPUT type="submit" >
</form>
</BODY>
</HTML>






Thanks,

gmann
 
Old September 8th, 2005, 02:17 PM
Registered User
 
Join Date: Sep 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi;

I answered my own question.

If you are working with a Web Form you need to add a reference to
the necessary class library, or you will get syntax errors.

When you add the following statement immediately after the </script> tag :
<%Import Namespace = "System.Web.UI"%>

the <asp:RadioButtonList> control example, on page 88, should work fine.

Gmann







Similar Threads
Thread Thread Starter Forum Replies Last Post
VB and ASP.NET question RomeyRome BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 2 December 20th, 2007 07:20 PM
Asp.net question asp.netUser ASP.NET 1.0 and 1.1 Basics 1 September 13th, 2005 03:23 PM





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