C
c676228
Hi all,
I cut and paste the following code from msdn help page which it just
introduces view and multiview server controls.
Here is what I do:
in vs studio 2005, File --> New Web Site, it brings me to the dir: C:\Visual
Studio 2005\WebSites\WebSite1, it creates default.aspx and default.aspx.vb
and I pasted the following code into default.aspx.
I go to build to build web site and it says:------ Build started: Project:
C:\...\WebSite1\, Configuration: Debug .NET ------
Validating Web Site
Building directory '/WebSite1/'.
So I created virtual dir website1 to point to C:\Visual Studio
2005\WebSites\WebSite1
Then I ran localhost/webSite1/default.aspx
The following error message comes up:
Parser Error Message: Unrecognized configuration section 'connectionStrings'
Source Error:
Line 10: <configuration>
Line 11: <appSettings/>
Line 12: <connectionStrings/>
Line 13: <system.web>
Line 14: <!--
Source File: C:\Visual Studio 2005\WebSites\WebSite1\web.config Line: 12
I don't know why since it is created by vs by default. so I commented out.
The open the page again, then the following message comes up:
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.
Parser Error Message: Child nodes are not allowed.
Source Error:
Line 25: <compilation debug="false" strict="false" explicit="true" />
Line 26: <pages>
Line 27: <namespaces>
Line 28: <clear />
Line 29: <add namespace="System" />
Source File: C:\Visual Studio 2005\WebSites\WebSite1\web.config Line: 27
and I delete that part.
And I opened the page again:
Now the error message is:
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.
Parser Error Message: Could not load type
System.Web.UI.WebControls.MultiView from assembly System.Web,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
Source Error:
Line 44: <h3>MultiView Class Example</h3>
Line 45:
Line 46: <asp:MultiView id="MultiView1"
Line 47: runat="Server">
Line 48:
Source File: C:\Visual Studio 2005\WebSites\WebSite1\default.aspx Line: 46
I never encounter this kind of problem before, can you help?
Thanks.
Betty
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<title>MultiView Class Example</title>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
' The first time the page loads,
' render the DefaultView.
If Not IsPostBack Then
' Set DefaultView as the active view.
MultiView1.SetActiveView(DefaultView)
End If
End Sub
Sub LinkButton_Command(sender As Object, e As
System.Web.UI.WebControls.CommandEventArgs)
' Determine which link button was clicked
' and set the active view to
' the view selected by the user.
Select Case (e.CommandArgument)
Case "DefaultView"
MultiView1.SetActiveView(DefaultView)
Case "News"
MultiView1.SetActiveView(NewsView)
Case "Shopping"
MultiView1.SetActiveView(ShoppingView)
Case Else
Throw New Exception("You did not select a valid list
item.")
End Select
End Sub
</script>
</head>
<body>
<form id="Form1" runat="server">
<h3>MultiView Class Example</h3>
<asp:MultiView id="MultiView1"
runat="Server">
<asp:View id="DefaultView"
runat="Server">
<aspanel id="DefaultViewPanel"
Width="330px"
BackColor="#C0C0FF"
BorderColor="#404040"
BorderStyle="Double"
runat="Server">
<asp:Label id="DefaultLabel1"
Font-bold="true"
Font-size="14"
Text="The Default View"
runat="Server"
AssociatedControlID="DefaultView">
</asp:Label>
<asp:BulletedList id="DefaultBulletedList1"
BulletStyle="Disc"
DisplayMode="Hyperlink"
Target="_blank"
runat="Server">
<asp:ListItem
Value="http://www.microsoft.com">Today's Weather</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's Stock Quotes</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's News Headlines</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's Featured Shopping</asp:ListItem>
</asp:BulletedList>
<hr />
<asp:Label id="DefaultLabel2"
Font-size="12"
Text="Click a link to display a different view:"
runat="Server">
</asp:Label><br />
<asp:LinkButton id="Default_NewsLink"
Text="Go to News View"
OnCommand="LinkButton_Command"
CommandArgument="News"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton>
<asp:LinkButton id="Default_ShoppingLink"
Text="Go to Shopping View"
OnCommand="LinkButton_Command"
CommandArgument="Shopping"
CommandName="Link"
Width="150px"
runat="server">
</asp:LinkButton><br /><br />
</aspanel>
</asp:View>
<asp:View id="NewsView"
runat="Server">
<aspanel id="NewsPanel1"
Width="330px"
BackColor="#C0FFC0"
BorderColor="#404040"
BorderStyle="Double"
runat="Server">
<asp:Label id="NewsLabel1"
Font-bold="true"
Font-size="14"
Text="The News View"
runat="Server"
AssociatedControlID="NewsView">
</asp:Label>
<asp:BulletedList id="NewsBulletedlist1"
BulletStyle="Disc"
DisplayMode="Hyperlink"
Target="_blank"
runat="Server">
<asp:ListItem
Value="http://www.microsoft.com">Today's International
Headlines</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's National Headlines</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's Local News</asp:ListItem>
</asp:BulletedList>
<hr />
<asp:Label id="NewsLabel2"
Font-size="12"
Text="Click a link to display a different view:"
runat="Server">
</asp:Label><br />
<asp:LinkButton id="News_DefaultLink"
Text="Go to the Default View"
OnCommand="LinkButton_Command"
CommandArgument="DefaultView"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton>
<asp:LinkButton id="News_ShoppingLink"
Text="Go to Shopping View"
OnCommand="LinkButton_Command"
CommandArgument="Shopping"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton><br /><br />
</aspanel>
</asp:View>
<asp:View id="ShoppingView"
runat="Server">
<aspanel id="ShoppingPanel1"
Width="330px"
BackColor="#FFFFC0"
BorderColor="#404040"
BorderStyle="Double"
runat="Server">
<asp:Label id="ShoppingLabel1"
Font-Bold="true"
Font-size="14"
Text="The Shopping View"
runat="Server"
AssociatedControlID="ShoppingView">
</asp:Label>
<asp:BulletedList id="ShoppingBulletedlist1"
BulletStyle="Disc"
DisplayMode="Hyperlink"
Target="_blank"
runat="Server">
<asp:ListItem
Value="http://www.microsoft.com">Shop for Home and Garden </asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Shop for Women's Fashions</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Shop for Men's Fashions</asp:ListItem>
</asp:BulletedList>
<hr />
<asp:Label id="ShoppingLabel2"
Font-size="12"
Text="Click a link to display a different view:"
runat="Server">
</asp:Label><br />
<asp:LinkButton id="Shopping_DefaultLink"
Text="Go to the Default View"
OnCommand="LinkButton_Command"
CommandArgument="DefaultView"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton>
<asp:LinkButton id="Shopping_NewsLink"
Text="Go to News View"
OnCommand="LinkButton_Command"
CommandArgument="News"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton><br /><br />
</aspanel>
</asp:View>
</asp:MultiView>
</form>
</body>
</html>
I cut and paste the following code from msdn help page which it just
introduces view and multiview server controls.
Here is what I do:
in vs studio 2005, File --> New Web Site, it brings me to the dir: C:\Visual
Studio 2005\WebSites\WebSite1, it creates default.aspx and default.aspx.vb
and I pasted the following code into default.aspx.
I go to build to build web site and it says:------ Build started: Project:
C:\...\WebSite1\, Configuration: Debug .NET ------
Validating Web Site
Building directory '/WebSite1/'.
So I created virtual dir website1 to point to C:\Visual Studio
2005\WebSites\WebSite1
Then I ran localhost/webSite1/default.aspx
The following error message comes up:
Parser Error Message: Unrecognized configuration section 'connectionStrings'
Source Error:
Line 10: <configuration>
Line 11: <appSettings/>
Line 12: <connectionStrings/>
Line 13: <system.web>
Line 14: <!--
Source File: C:\Visual Studio 2005\WebSites\WebSite1\web.config Line: 12
I don't know why since it is created by vs by default. so I commented out.
The open the page again, then the following message comes up:
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.
Parser Error Message: Child nodes are not allowed.
Source Error:
Line 25: <compilation debug="false" strict="false" explicit="true" />
Line 26: <pages>
Line 27: <namespaces>
Line 28: <clear />
Line 29: <add namespace="System" />
Source File: C:\Visual Studio 2005\WebSites\WebSite1\web.config Line: 27
and I delete that part.
And I opened the page again:
Now the error message is:
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.
Parser Error Message: Could not load type
System.Web.UI.WebControls.MultiView from assembly System.Web,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
Source Error:
Line 44: <h3>MultiView Class Example</h3>
Line 45:
Line 46: <asp:MultiView id="MultiView1"
Line 47: runat="Server">
Line 48:
Source File: C:\Visual Studio 2005\WebSites\WebSite1\default.aspx Line: 46
I never encounter this kind of problem before, can you help?
Thanks.
Betty
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<title>MultiView Class Example</title>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
' The first time the page loads,
' render the DefaultView.
If Not IsPostBack Then
' Set DefaultView as the active view.
MultiView1.SetActiveView(DefaultView)
End If
End Sub
Sub LinkButton_Command(sender As Object, e As
System.Web.UI.WebControls.CommandEventArgs)
' Determine which link button was clicked
' and set the active view to
' the view selected by the user.
Select Case (e.CommandArgument)
Case "DefaultView"
MultiView1.SetActiveView(DefaultView)
Case "News"
MultiView1.SetActiveView(NewsView)
Case "Shopping"
MultiView1.SetActiveView(ShoppingView)
Case Else
Throw New Exception("You did not select a valid list
item.")
End Select
End Sub
</script>
</head>
<body>
<form id="Form1" runat="server">
<h3>MultiView Class Example</h3>
<asp:MultiView id="MultiView1"
runat="Server">
<asp:View id="DefaultView"
runat="Server">
<aspanel id="DefaultViewPanel"
Width="330px"
BackColor="#C0C0FF"
BorderColor="#404040"
BorderStyle="Double"
runat="Server">
<asp:Label id="DefaultLabel1"
Font-bold="true"
Font-size="14"
Text="The Default View"
runat="Server"
AssociatedControlID="DefaultView">
</asp:Label>
<asp:BulletedList id="DefaultBulletedList1"
BulletStyle="Disc"
DisplayMode="Hyperlink"
Target="_blank"
runat="Server">
<asp:ListItem
Value="http://www.microsoft.com">Today's Weather</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's Stock Quotes</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's News Headlines</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's Featured Shopping</asp:ListItem>
</asp:BulletedList>
<hr />
<asp:Label id="DefaultLabel2"
Font-size="12"
Text="Click a link to display a different view:"
runat="Server">
</asp:Label><br />
<asp:LinkButton id="Default_NewsLink"
Text="Go to News View"
OnCommand="LinkButton_Command"
CommandArgument="News"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton>
<asp:LinkButton id="Default_ShoppingLink"
Text="Go to Shopping View"
OnCommand="LinkButton_Command"
CommandArgument="Shopping"
CommandName="Link"
Width="150px"
runat="server">
</asp:LinkButton><br /><br />
</aspanel>
</asp:View>
<asp:View id="NewsView"
runat="Server">
<aspanel id="NewsPanel1"
Width="330px"
BackColor="#C0FFC0"
BorderColor="#404040"
BorderStyle="Double"
runat="Server">
<asp:Label id="NewsLabel1"
Font-bold="true"
Font-size="14"
Text="The News View"
runat="Server"
AssociatedControlID="NewsView">
</asp:Label>
<asp:BulletedList id="NewsBulletedlist1"
BulletStyle="Disc"
DisplayMode="Hyperlink"
Target="_blank"
runat="Server">
<asp:ListItem
Value="http://www.microsoft.com">Today's International
Headlines</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's National Headlines</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's Local News</asp:ListItem>
</asp:BulletedList>
<hr />
<asp:Label id="NewsLabel2"
Font-size="12"
Text="Click a link to display a different view:"
runat="Server">
</asp:Label><br />
<asp:LinkButton id="News_DefaultLink"
Text="Go to the Default View"
OnCommand="LinkButton_Command"
CommandArgument="DefaultView"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton>
<asp:LinkButton id="News_ShoppingLink"
Text="Go to Shopping View"
OnCommand="LinkButton_Command"
CommandArgument="Shopping"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton><br /><br />
</aspanel>
</asp:View>
<asp:View id="ShoppingView"
runat="Server">
<aspanel id="ShoppingPanel1"
Width="330px"
BackColor="#FFFFC0"
BorderColor="#404040"
BorderStyle="Double"
runat="Server">
<asp:Label id="ShoppingLabel1"
Font-Bold="true"
Font-size="14"
Text="The Shopping View"
runat="Server"
AssociatedControlID="ShoppingView">
</asp:Label>
<asp:BulletedList id="ShoppingBulletedlist1"
BulletStyle="Disc"
DisplayMode="Hyperlink"
Target="_blank"
runat="Server">
<asp:ListItem
Value="http://www.microsoft.com">Shop for Home and Garden </asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Shop for Women's Fashions</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Shop for Men's Fashions</asp:ListItem>
</asp:BulletedList>
<hr />
<asp:Label id="ShoppingLabel2"
Font-size="12"
Text="Click a link to display a different view:"
runat="Server">
</asp:Label><br />
<asp:LinkButton id="Shopping_DefaultLink"
Text="Go to the Default View"
OnCommand="LinkButton_Command"
CommandArgument="DefaultView"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton>
<asp:LinkButton id="Shopping_NewsLink"
Text="Go to News View"
OnCommand="LinkButton_Command"
CommandArgument="News"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton><br /><br />
</aspanel>
</asp:View>
</asp:MultiView>
</form>
</body>
</html>