473,839 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DropDownList MasterPage Error Navigate To URL erro help.

20 New Member
I hope someone can help me. I have an error that I can not seem to figure out. All I need is an unbound dropdownlist to navigate to urls withing the website. I have gotten as far as to populate field but I am stuck at this point. I am new to asp.net and this is my first website.

Below is my code please help.

Content controls have to be top-level controls in a content page or a nested master page that references a master page.


--------------------------------------------------------------------------------
This is the error

HttpException (0x80004005): Content controls have to be top-level controls in a content page or a nested master page that references a master page.] System.Web.UI.M asterPage.Creat eMaster(Templat eControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplate Collection) +533 System.Web.UI.P age.get_Master( ) +49 System.Web.UI.P age.ApplyMaster Page() +17 System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +1368
This error seems to indicate that the way I have placed the code is incorrect but I am unsure how to format it correctly.

Here is the code below
<%@ Page Language="VB" MasterPageFile= "~/MasterPage2.mas ter" AutoEventWireup ="true" Title="Welcome Guest"%>
<script language="VB" script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s)



Dim blnAutoNav As Boolean

If Not Page.IsPostBack Then
' Create a new ListItemCollect ion
Dim myLocations As New ListItemCollect ion()

' Add items to the collection
myLocations.Add (New ListItem("Where do you want to go?", Request.ServerV ariables("URL") ))
myLocations.Add (New ListItem("Reque st Membership", "http://www.url.com/CreateAccount.a spx"))
myLocations.Add (New ListItem("FAQS" ))


' Databind our DDL to the ListItemCollect ion we just filled
ddlLocations.Da taSource = myLocations
ddlLocations.Da taTextField = "Text"
ddlLocations.Da taValueField = "Value"
ddlLocations.Da taBind()
End If

' Find out current auto-navigation status and add JS to handle it if needed.
If Request.QuerySt ring("auto") = "True" Then
blnAutoNav = True

' This adds the javascript to automatically redirect to the selected
' location whenever a new item is selected in the dropdownlist.
ddlLocations.At tributes("oncha nge") = "javascript:win dow.location = " _
& "document.frmNa v.ddlLocations[document.frmNav .ddlLocations.s electedIndex].value;"
Else
blnAutoNav = False
End If

' Add the link to this page that toggles the autonav to
' the opposite of its current setting.
litAutoNavLink. Text = "<a href=""" & Request.ServerV ariables("URL") _
& "?auto=" & CStr(Not (blnAutoNav)) & """>Toggle Auto Navigation</a>"
End Sub

Sub btnGo_Click(ByV al sender As Object, ByVal e As EventArgs)
Response.Redire ct(ddlLocations .SelectedItem.V alue)
End Sub

</script>




<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1">

<form id="frmNav" runat="server">
&nbsp;


<p>
<asp:literal id="litAutoNavL ink" runat="server" />
</p>

</form>


<div style="right: -342px; width: 359px; position: relative; top: -83px; height: 44px">

<asp:DropDownLi st id="ddlLocation s" runat="server" style="position : relative" Width="201px" />

<asp:Button id="btnGo" runat="server"
Text = "Go"
OnClick = "btnGo_Clic k" style="position : relative"
/></div>



</asp:Content>
Jun 19 '07 #1
0 2434

Sign in to post your reply or Sign up for a free account.

Similar topics

0
6150
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug file as folows. I need help to resolve them ASAP: cl /c /nologo /MDd /W3 /Od /GR /GM /Zi /GX /D "_DEBUG" /D " WIN32" /D "_W INDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /
2
1547
by: JR | last post by:
I am attempting to display two list boxes. In the first list box is a listing of all entities. When a entity is selected and it has a subentity the second list box displays with a list of the subentities. The code works but I get an error at the following two steps: (Code is VB.Net on a form 'set the data source to the data set's table SubEntit lstSubEntity.DataSource = dsData.Tables("SubEntity" 'display the columns subentity nam...
9
15318
by: Marco Nova | last post by:
Hello I'm using the latest version of Visual Studio 2003 version 7.1.3088, .net framework 1.1.4322 and I've some problem compiling a project, it give me the error c:\build\main\.....\methodeInc.h(36) : fatal error C1001: INTERNAL COMPILER ERRO (compiler file 'msc1.cpp', line 2701) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more informatio I was able to...
0
1094
by: Michael | last post by:
Hi Everyone, I had posted a message about the dropdownlist not displaying newly added items. Just alittle background. I'm working with a masterpage and a usercontrol(Search control) (VS2005) that contains a few controls and a dropdownlist. Once the user logs in I have a event that is triggered(Master page captures event) from another usercontrol(login) and executes LoadAdminOptions. So I thought I'd start from scratch and wrote the...
9
3417
by: Lammert | last post by:
Good morning, I create an ASP.NET 2.0 web application. The situation: 1. One masterpage where the users can select an organisation in a DropDownList. 2. Different content pages. I will get the value of the DropDownList in the Page_PreInit event. How can I do that? The content in the content and master pages is based on
2
1295
by: needin4mation | last post by:
I remember in 1.1 that I would put not to populate a given dropdownlist unless it was not Page.IsPostBack. But in 2.0 where I use the DAL and no codefile, I don't see where to effect this. Any help is appreciated. I want my dropdownlist to keep what the use selected when the page refreshes. Thanks.
2
3306
by: jnoody | last post by:
The problem I am having is with the SelectedIndexChanged event not always firing or the SelectedIndex property not being correct when the event does fire. The code is below, but here are some details first. The DropDownList is actually a custom control called DropDownListWithCommandEvent that inherits from DropDownList. The reason I have created this is to create a DropDownList that will bubble a Command event to the containing...
2
1789
by: teddymeu | last post by:
Hi Guys, this is kinda complicated but ill do my best to explain. I have two tables. products and categories. Products holds product info and an image, its primary key is ProductID. Category table holds a category name and description and a primary key CategoryID. The producs table holds a Foreign key field called CategoryID which points to the CategoryID Primary key of the catgory table. Ok i have two asp.net 2 vb forms. One is using a...
18
5440
by: Redhairs | last post by:
Is it possible to get DropDownList.SelectedValue in Page_PreInit() event during the postback?
0
9698
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10654
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10298
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9429
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7833
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5683
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4494
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4066
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.