我有一个从 Visual Studio 运行并安装在我的机器上时工作正常的页面。但是,一旦我将它安装到我们的服务器上,该页面最初会正常加载,但是当单击该按钮时,它只会返回“未找到 URL”错误。
我已将问题追溯到下拉列表的数据绑定。如果我删除它,该页面在服务器上运行良好。
任何有关在服务器或我的代码中查看内容的建议将不胜感激。
我的 aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="SearchLandmarks.aspx.cs" Inherits="TripRequestPortal.SearchLandmarks" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div>
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManagerSearchLandmarks" runat="server" />
<asp:Label ID="lblCustomerNumber" runat="server" Visible="false" />
</div>
<div>
<asp:CheckBox ID="chkBoxDateFrom" runat="server" />
<asp:Label ID="lblDateFrom" runat="server" Text="Date From: " />
<asp:TextBox ID="txtDateFrom" runat="server" />
<asp:Image ID="imageDateFrom" runat="server" ImageUrl="~/Images/calendar_icon.jpg" />
<ajaxToolkit:CalendarExtender ID="calendarExtenderDateFrom" runat="server" TargetControlID="txtDateFrom" Format="MM/dd/yyyy" PopupButtonID="imageDateFrom" />
<ajaxToolkit:MaskedEditExtender ID="MaskedEditExtenderDateFrom" runat="server" TargetControlID="txtDateFrom" Mask="99/99/9999" MaskType="Date"/>
<ajaxToolkit:MaskedEditValidator ID="MaskedEditValidatorDateFrom" runat="server" ControlToValidate="txtDateFrom" ControlExtender="MaskedEditExtenderDateFrom" IsValidEmpty="true" InvalidValueMessage="Inputted date not valid." EmptyValueMessage="Check box is checked so a date is required." />
</div>
<div>
<asp:CheckBox ID="chkBoxOrigin" runat="server" />
<asp:Label ID="lblOrigin" runat="server" Text="Label" />
<asp:DropDownList ID="listOrigins" runat="server" DataSourceID="SqlDataSource1"
DataTextField="LANDMARKNAME" DataValueField="PRIKEY" />
</div>
<div>
<asp:Button ID="btnSearch" runat="server" Text="Search"
onclick="btnSearch_Click" />
</div>
<div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionStringTripStatus %>"
FilterExpression="customer='{0}'"
ProviderName="<%$ ConnectionStrings:ConnectionStringTripStatus.ProviderName %>"
SelectCommand="SELECT PRIKEY, CUSTOMER, CONCAT(CONCAT(LANDMARKNAME, ' | '), SITEID) AS LANDMARKNAME FROM LANDMARKS ORDER BY LANDMARKNAME">
<FilterParameters>
<asp:ControlParameter ControlID="lblCustomerNumber" DefaultValue="-1"
Name="newparameter" PropertyName="Text" />
</FilterParameters>
</asp:SqlDataSource>
</div>
</asp:Content>
我的代码在后面
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TripRequestPortal
{
public partial class SearchLandmarks : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lblCustomerNumber.Text = "5";
}
protected void btnSearch_Click(object sender, EventArgs e)
{
Response.Redirect("TripEntry.aspx");
}
}
}
谢谢