Hi Everyone!
I have a aspx page that when accessed through the web server it brings up a dropdown box connected to names of three different .aspx pages which are derived from 3 different SQL Server 2000 tables. When bringing up the initial page and when a selection is made from the dropdown box it displays a 404 error.
I'm sure it is not the code (which I will include at the bottom) because when I bring up the actual .aspx page in visual basic and right click to "View in Browser" the page and the links work fine. Also, when trying to access the links directly (without using the dropdown box) they also come up with a 404 error. I think this probably has to do something with the web.config file but everytime I try to move the file from the parent directory of my folder, the main page does not even come up. I tried to place it within my folder but the same error is displayed. I think I may have to set up a different web.config for each page but I'm not sure how to do this and I also read that I shouldn't have to. Also, all 4 pages are located in the same folder. I think I have covered everything I'm away of but if there is anything else needed to attempt to solve this problem please let me know Thanks!!
Code for Initial page:
<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim blnAutoNav As Boolean
If Not Page.IsPostBack Then
' Create a new ListItemCollection
Dim myLocations As New ListItemCollection()
' Add items to the collection
myLocations.Add(New ListItem("Select a Table to Display", Request.ServerVariables("URL")))
myLocations.Add(New ListItem("ToddsTable1", "ToddsTable1.aspx"))
myLocations.Add(New ListItem("CA", "CA.aspx"))
myLocations.Add(New ListItem("XH", "XH.aspx"))
' Databind our DDL to the ListItemCollection we just filled
ddlLocations.DataSource = myLocations
ddlLocations.DataTextField = "Text"
ddlLocations.DataValueField = "Value"
ddlLocations.DataBind()
End If
' Find out current auto-navigation status and add JS to handle it if needed.
If Request.QueryString("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.Attributes("onchange") = "javascript:window.location = " _
& "document.frmNav.ddlLocations[document.frmNav.ddlLocations.selectedIndex].value;"
Else
blnAutoNav = False
End If
End Sub
Sub btnGo_Click(sender As Object, e As EventArgs)
Response.Redirect(ddlLocations.SelectedItem.Value)
End Sub
</script>
<html>
<head>
<title>Collection of Tables from SQL Server displayed in ASP.NET</title>
<script language="javascript" type="text/javascript">
// <!CDATA[
function TextArea1_onclick() {
}
// ]]>
</script>
</head>
<body style="vertical-align: middle; text-align: center" bgcolor="#cc3300">
<form id="frmNav" runat="server">
<br />
<asp:Label ID="Label1" runat="server" Height="40px" Text="Switchboard to run ASP.NET from SQL Server 2000" Width="248px" style="border-right: teal thin groove; border-top: teal thin groove; font-weight: bold; vertical-align: middle; border-left: teal thin groove; color: #ff0000; border-bottom: teal thin groove; text-align: center" BackColor="#E0E0E0"></asp:Label><br />
<br />
<br />
<asp
ropDownList id="ddlLocations" runat="server" BackColor="#E0E0E0" style="font-weight: bolder; color: red" />
<asp:Button id="btnGo" runat="server"
Text = "Go"
OnClick = "btnGo_Click"
/>
<br />
<br />
<br />
<br />
<br />
<br />
</form>
</body>
</html>
Code for secondary page:
<%@ Page Language="VB" Debug = "true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<script runat="server">
</script>
<html xmlns=" >
<head runat="server">
<title>CA Table</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table border="1" class="ex" width="100%">
<tr>
<td>
<pre>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="#CCCCCC"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2"
DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display."
ForeColor="Black">
<FooterStyle BackColor="#CCCCCC" />
<Columns>
<asp:BoundField DataField="EIAC" HeaderText="EIAC" SortExpression="EIAC" />
<asp:BoundField DataField="LCN" HeaderText="LCN" SortExpression="LCN" />
<asp:BoundField DataField="ALC" HeaderText="ALC" SortExpression="ALC" />
<asp:BoundField DataField="LTY" HeaderText="LTY" SortExpression="LTY" />
<asp:BoundField DataField="TASK" HeaderText="TASK" SortExpression="TASK" />
<asp:BoundField DataField="REF_EIAC" HeaderText="REF_EIAC" SortExpression="REF_EIAC" />
<asp:BoundField DataField="REF_LCN" HeaderText="REF_LCN" SortExpression="REF_LCN" />
<asp:BoundField DataField="REF_ALC" HeaderText="REF_ALC" SortExpression="REF_ALC" />
<asp:BoundField DataField="REF_LTY" HeaderText="REF_LTY" SortExpression="REF_LTY" />
<asp:BoundField DataField="REF_TASK" HeaderText="REF_TASK" SortExpression="REF_TASK" />
<asp:BoundField DataField="AOR_LCN" HeaderText="AOR_LCN" SortExpression="AOR_LCN" />
<asp:BoundField DataField="AOR_ALC" HeaderText="AOR_ALC" SortExpression="AOR_ALC" />
<asp:BoundField DataField="AOR_LTY" HeaderText="AOR_LTY" SortExpression="AOR_LTY" />
<asp:BoundField DataField="AOR_MB" HeaderText="AOR_MB" SortExpression="AOR_MB" />
<asp:BoundField DataField="IDENT" HeaderText="IDENT" SortExpression="IDENT" />
<asp:BoundField DataField="FREQ" HeaderText="FREQ" SortExpression="FREQ" />
<asp:BoundField DataField="CC" HeaderText="CC" SortExpression="CC" />
<asp:BoundField DataField="HCP" HeaderText="HCP" SortExpression="HCP" />
<asp:BoundField DataField="HMPC" HeaderText="HMPC" SortExpression="HMPC" />
<asp:BoundField DataField="PMCS" HeaderText="PMCS" SortExpression="PMCS" />
<asp:BoundField DataField="MMET" HeaderText="MMET" SortExpression="MMET" />
<asp:BoundField DataField="PMET" HeaderText="PMET" SortExpression="PMET" />
<asp:BoundField DataField="MMMH" HeaderText="MMMH" SortExpression="MMMH" />
<asp:BoundField DataField="PMMH" HeaderText="PMMH" SortExpression="PMMH" />
<asp:BoundField DataField="PMD" HeaderText="PMD" SortExpression="PMD" />
<asp:BoundField DataField="SMD" HeaderText="SMD" SortExpression="SMD" />
<asp:BoundField DataField="FRC" HeaderText="FRC" SortExpression="FRC" />
<asp:BoundField DataField="TERC" HeaderText="TERC" SortExpression="TERC" />
<asp:BoundField DataField="TRT" HeaderText="TRT" SortExpression="TRT" />
<asp:BoundField DataField="TLR" HeaderText="TLR" SortExpression="TLR" />
<asp:BoundField DataField="TR" HeaderText="TR" SortExpression="TR" />
<asp:BoundField DataField="TRC" HeaderText="TRC" SortExpression="TRC" />
<asp:BoundField DataField="TPSA" HeaderText="TPSA" SortExpression="TPSA" />
<asp:BoundField DataField="TPSB" HeaderText="TPSB" SortExpression="TPSB" />
<asp:BoundField DataField="TPSC" HeaderText="TPSC" SortExpression="TPSC" />
<asp:BoundField DataField="TCA" HeaderText="TCA" SortExpression="TCA" />
<asp:BoundField DataField="TCB" HeaderText="TCB" SortExpression="TCB" />
<asp:BoundField DataField="TCC" HeaderText="TCC" SortExpression="TCC" />
<asp:CheckBoxField DataField="Baselined" HeaderText="Baselined" SortExpression="Baselined" />
<asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
</Columns>
<RowStyle BackColor="White" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
</asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:upsizedCandidateConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:upsizedCandidateConnectionString1.ProviderName %>"
SelectCommand="SELECT [EIAC], [LCN], [ALC], [LTY], [TASK], [REF_EIAC], [REF_LCN], [REF_ALC], [REF_LTY], [REF_TASK], [AOR_LCN], [AOR_ALC], [AOR_LTY], [AOR_MB], [IDENT], [FREQ], [CC], [HCP], [HMPC], [PMCS], [MMET], [PMET], [MMMH], [PMMH], [PMD], [SMD], [FRC], [TERC], [TRT], [TLR], [TR], [TRC], [TPSA], [TPSB], [TPSC], [TCA], [TCB], [TCC], [Baselined], [Date] FROM [CA]">
</asp:SqlDataSource> </pre>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
I have a aspx page that when accessed through the web server it brings up a dropdown box connected to names of three different .aspx pages which are derived from 3 different SQL Server 2000 tables. When bringing up the initial page and when a selection is made from the dropdown box it displays a 404 error.
I'm sure it is not the code (which I will include at the bottom) because when I bring up the actual .aspx page in visual basic and right click to "View in Browser" the page and the links work fine. Also, when trying to access the links directly (without using the dropdown box) they also come up with a 404 error. I think this probably has to do something with the web.config file but everytime I try to move the file from the parent directory of my folder, the main page does not even come up. I tried to place it within my folder but the same error is displayed. I think I may have to set up a different web.config for each page but I'm not sure how to do this and I also read that I shouldn't have to. Also, all 4 pages are located in the same folder. I think I have covered everything I'm away of but if there is anything else needed to attempt to solve this problem please let me know Thanks!!
Code for Initial page:
<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim blnAutoNav As Boolean
If Not Page.IsPostBack Then
' Create a new ListItemCollection
Dim myLocations As New ListItemCollection()
' Add items to the collection
myLocations.Add(New ListItem("Select a Table to Display", Request.ServerVariables("URL")))
myLocations.Add(New ListItem("ToddsTable1", "ToddsTable1.aspx"))
myLocations.Add(New ListItem("CA", "CA.aspx"))
myLocations.Add(New ListItem("XH", "XH.aspx"))
' Databind our DDL to the ListItemCollection we just filled
ddlLocations.DataSource = myLocations
ddlLocations.DataTextField = "Text"
ddlLocations.DataValueField = "Value"
ddlLocations.DataBind()
End If
' Find out current auto-navigation status and add JS to handle it if needed.
If Request.QueryString("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.Attributes("onchange") = "javascript:window.location = " _
& "document.frmNav.ddlLocations[document.frmNav.ddlLocations.selectedIndex].value;"
Else
blnAutoNav = False
End If
End Sub
Sub btnGo_Click(sender As Object, e As EventArgs)
Response.Redirect(ddlLocations.SelectedItem.Value)
End Sub
</script>
<html>
<head>
<title>Collection of Tables from SQL Server displayed in ASP.NET</title>
<script language="javascript" type="text/javascript">
// <!CDATA[
function TextArea1_onclick() {
}
// ]]>
</script>
</head>
<body style="vertical-align: middle; text-align: center" bgcolor="#cc3300">
<form id="frmNav" runat="server">
<br />
<asp:Label ID="Label1" runat="server" Height="40px" Text="Switchboard to run ASP.NET from SQL Server 2000" Width="248px" style="border-right: teal thin groove; border-top: teal thin groove; font-weight: bold; vertical-align: middle; border-left: teal thin groove; color: #ff0000; border-bottom: teal thin groove; text-align: center" BackColor="#E0E0E0"></asp:Label><br />
<br />
<br />
<asp

<asp:Button id="btnGo" runat="server"
Text = "Go"
OnClick = "btnGo_Click"
/>
<br />
<br />
<br />
<br />
<br />
<br />
</form>
</body>
</html>
Code for secondary page:
<%@ Page Language="VB" Debug = "true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<script runat="server">
</script>
<html xmlns=" >
<head runat="server">
<title>CA Table</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table border="1" class="ex" width="100%">
<tr>
<td>
<pre>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="#CCCCCC"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2"
DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display."
ForeColor="Black">
<FooterStyle BackColor="#CCCCCC" />
<Columns>
<asp:BoundField DataField="EIAC" HeaderText="EIAC" SortExpression="EIAC" />
<asp:BoundField DataField="LCN" HeaderText="LCN" SortExpression="LCN" />
<asp:BoundField DataField="ALC" HeaderText="ALC" SortExpression="ALC" />
<asp:BoundField DataField="LTY" HeaderText="LTY" SortExpression="LTY" />
<asp:BoundField DataField="TASK" HeaderText="TASK" SortExpression="TASK" />
<asp:BoundField DataField="REF_EIAC" HeaderText="REF_EIAC" SortExpression="REF_EIAC" />
<asp:BoundField DataField="REF_LCN" HeaderText="REF_LCN" SortExpression="REF_LCN" />
<asp:BoundField DataField="REF_ALC" HeaderText="REF_ALC" SortExpression="REF_ALC" />
<asp:BoundField DataField="REF_LTY" HeaderText="REF_LTY" SortExpression="REF_LTY" />
<asp:BoundField DataField="REF_TASK" HeaderText="REF_TASK" SortExpression="REF_TASK" />
<asp:BoundField DataField="AOR_LCN" HeaderText="AOR_LCN" SortExpression="AOR_LCN" />
<asp:BoundField DataField="AOR_ALC" HeaderText="AOR_ALC" SortExpression="AOR_ALC" />
<asp:BoundField DataField="AOR_LTY" HeaderText="AOR_LTY" SortExpression="AOR_LTY" />
<asp:BoundField DataField="AOR_MB" HeaderText="AOR_MB" SortExpression="AOR_MB" />
<asp:BoundField DataField="IDENT" HeaderText="IDENT" SortExpression="IDENT" />
<asp:BoundField DataField="FREQ" HeaderText="FREQ" SortExpression="FREQ" />
<asp:BoundField DataField="CC" HeaderText="CC" SortExpression="CC" />
<asp:BoundField DataField="HCP" HeaderText="HCP" SortExpression="HCP" />
<asp:BoundField DataField="HMPC" HeaderText="HMPC" SortExpression="HMPC" />
<asp:BoundField DataField="PMCS" HeaderText="PMCS" SortExpression="PMCS" />
<asp:BoundField DataField="MMET" HeaderText="MMET" SortExpression="MMET" />
<asp:BoundField DataField="PMET" HeaderText="PMET" SortExpression="PMET" />
<asp:BoundField DataField="MMMH" HeaderText="MMMH" SortExpression="MMMH" />
<asp:BoundField DataField="PMMH" HeaderText="PMMH" SortExpression="PMMH" />
<asp:BoundField DataField="PMD" HeaderText="PMD" SortExpression="PMD" />
<asp:BoundField DataField="SMD" HeaderText="SMD" SortExpression="SMD" />
<asp:BoundField DataField="FRC" HeaderText="FRC" SortExpression="FRC" />
<asp:BoundField DataField="TERC" HeaderText="TERC" SortExpression="TERC" />
<asp:BoundField DataField="TRT" HeaderText="TRT" SortExpression="TRT" />
<asp:BoundField DataField="TLR" HeaderText="TLR" SortExpression="TLR" />
<asp:BoundField DataField="TR" HeaderText="TR" SortExpression="TR" />
<asp:BoundField DataField="TRC" HeaderText="TRC" SortExpression="TRC" />
<asp:BoundField DataField="TPSA" HeaderText="TPSA" SortExpression="TPSA" />
<asp:BoundField DataField="TPSB" HeaderText="TPSB" SortExpression="TPSB" />
<asp:BoundField DataField="TPSC" HeaderText="TPSC" SortExpression="TPSC" />
<asp:BoundField DataField="TCA" HeaderText="TCA" SortExpression="TCA" />
<asp:BoundField DataField="TCB" HeaderText="TCB" SortExpression="TCB" />
<asp:BoundField DataField="TCC" HeaderText="TCC" SortExpression="TCC" />
<asp:CheckBoxField DataField="Baselined" HeaderText="Baselined" SortExpression="Baselined" />
<asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
</Columns>
<RowStyle BackColor="White" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
</asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:upsizedCandidateConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:upsizedCandidateConnectionString1.ProviderName %>"
SelectCommand="SELECT [EIAC], [LCN], [ALC], [LTY], [TASK], [REF_EIAC], [REF_LCN], [REF_ALC], [REF_LTY], [REF_TASK], [AOR_LCN], [AOR_ALC], [AOR_LTY], [AOR_MB], [IDENT], [FREQ], [CC], [HCP], [HMPC], [PMCS], [MMET], [PMET], [MMMH], [PMMH], [PMD], [SMD], [FRC], [TERC], [TRT], [TLR], [TR], [TRC], [TPSA], [TPSB], [TPSC], [TCA], [TCB], [TCC], [Baselined], [Date] FROM [CA]">
</asp:SqlDataSource> </pre>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>