Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# aspx应用程序在本地主机上工作正常,但在在线服务器上工作不正常_C#_Asp.net - Fatal编程技术网

C# aspx应用程序在本地主机上工作正常,但在在线服务器上工作不正常

C# aspx应用程序在本地主机上工作正常,但在在线服务器上工作不正常,c#,asp.net,C#,Asp.net,花了几个小时后仍然找不到我的问题。我正在使用asp.net应用程序,在这个应用程序中,我需要通过代码隐藏文件填充下拉控件选项。它在我的本地主机上运行得非常好,但当我在在线网站上检查它时,它不起作用。该页面显示不带任何选项的下拉框 AspxFile <%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="About.aspx.cs" E

花了几个小时后仍然找不到我的问题。我正在使用asp.net应用程序,在这个应用程序中,我需要通过代码隐藏文件填充下拉控件选项。它在我的本地主机上运行得非常好,但当我在在线网站上检查它时,它不起作用。该页面显示不带任何选项的下拉框

AspxFile

 <%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="About.aspx.cs" EnableEventValidation="true" Inherits="Acc.About" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
    About
</h2>
<p>
    Put content here.
</p>
<form runat="server">
<div>
<asp:DropDownList id="modelItem" runat="server">
 <asp:ListItem>Select </asp:ListItem>
</asp:DropDownList>
 </div>
<div>
<asp:DropDownList id="ddl_update" runat="server">
  <asp:ListItem>Select </asp:ListItem>
</asp:DropDownList>
</div>
</form>

</asp:Content>
namespace Acc {


public partial class About {

    /// <summary>
    /// modelItem control.
    /// </summary>
    /// <remarks>
    /// Auto-generated field.
    /// To modify move field declaration from designer file to code-behind file.
    /// </remarks>
    protected global::System.Web.UI.WebControls.DropDownList modelItem;

    /// <summary>
    /// ddl_update control.
    /// </summary>
    /// <remarks>
    /// Auto-generated field.
    /// To modify move field declaration from designer file to code-behind file.
    /// </remarks>
    protected global::System.Web.UI.WebControls.DropDownList ddl_update;
}
}
设计人员文件

 <%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="About.aspx.cs" EnableEventValidation="true" Inherits="Acc.About" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
    About
</h2>
<p>
    Put content here.
</p>
<form runat="server">
<div>
<asp:DropDownList id="modelItem" runat="server">
 <asp:ListItem>Select </asp:ListItem>
</asp:DropDownList>
 </div>
<div>
<asp:DropDownList id="ddl_update" runat="server">
  <asp:ListItem>Select </asp:ListItem>
</asp:DropDownList>
</div>
</form>

</asp:Content>
namespace Acc {


public partial class About {

    /// <summary>
    /// modelItem control.
    /// </summary>
    /// <remarks>
    /// Auto-generated field.
    /// To modify move field declaration from designer file to code-behind file.
    /// </remarks>
    protected global::System.Web.UI.WebControls.DropDownList modelItem;

    /// <summary>
    /// ddl_update control.
    /// </summary>
    /// <remarks>
    /// Auto-generated field.
    /// To modify move field declaration from designer file to code-behind file.
    /// </remarks>
    protected global::System.Web.UI.WebControls.DropDownList ddl_update;
}
}
名称空间Acc{
公共部分类关于{
/// 
///模型项控件。
/// 
/// 
///自动生成的字段。
///将字段声明从设计器文件修改为代码隐藏文件。
/// 
受保护的全局::System.Web.UI.WebControl.DropDownList modelItem;
/// 
///ddl_更新控件。
/// 
/// 
///自动生成的字段。
///将字段声明从设计器文件修改为代码隐藏文件。
/// 
受保护的全局::System.Web.UI.WebControls.DropDownList ddl_更新;
}
}

什么不起作用?你能看到你的网页吗?你有错误吗?问题出在哪里?发生了什么事?你需要提供更多关于什么不起作用的详细信息。@Shannon Holsinger,Joel Lee我没有收到任何错误消息,它只是显示没有选项的下拉列表框。我需要从CodeBehind中填充它。您真的需要这一行吗?
EnableEventValidation=“true”
我想知道它是否工作,但它正在调用这一
Page\u Load
两次尝试放置一些
如果(!IsPostBackCode)
将数据编码或存储在会话变量中,然后绑定会话对象的下拉列表。打开列表框时,列表框中的项目是否存在?我看不出您在哪里为您的SELECT ListItem设置selectedindex=0或设置selected=true什么不起作用?你能看到你的网页吗?你有错误吗?问题出在哪里?发生了什么事?你需要提供更多关于什么不起作用的详细信息。@Shannon Holsinger,Joel Lee我没有收到任何错误消息,它只是显示没有选项的下拉列表框。我需要从CodeBehind中填充它。您真的需要这一行吗?
EnableEventValidation=“true”
我想知道它是否工作,但它正在调用这一
Page\u Load
两次尝试放置一些
如果(!IsPostBackCode)
将数据编码或存储在会话变量中,然后绑定会话对象的下拉列表。打开列表框时,列表框中的项目是否存在?我看不出您在哪里为选择列表项设置了selectedindex=0或selected=true