Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.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
Asp.net 为什么我的dropdownlist在回发后在实时环境中而不是在测试中清除?_Asp.net_Dynamics Crm - Fatal编程技术网

Asp.net 为什么我的dropdownlist在回发后在实时环境中而不是在测试中清除?

Asp.net 为什么我的dropdownlist在回发后在实时环境中而不是在测试中清除?,asp.net,dynamics-crm,Asp.net,Dynamics Crm,我在ASP.NET web表单上有一个下拉列表。它被设置为autopostback,并且viewstate处于启用状态。当我从VisualStudio运行项目时,我可以更改值,在回发中拾取新值,并在网格中显示一些相关结果(基础设施)。我可以不断更改值,网格也会正确更新 当我将其从测试/开发框复制到live Windows 2008服务器时,所有更改都会被删除。对下拉列表的第一次更改会导致回发,但网格不会更新,因为dropdownlist的SelectedIndexChanged事件不会触发。第二

我在ASP.NET web表单上有一个下拉列表。它被设置为autopostback,并且viewstate处于启用状态。当我从VisualStudio运行项目时,我可以更改值,在回发中拾取新值,并在网格中显示一些相关结果(基础设施)。我可以不断更改值,网格也会正确更新

当我将其从测试/开发框复制到live Windows 2008服务器时,所有更改都会被删除。对下拉列表的第一次更改会导致回发,但网格不会更新,因为dropdownlist的SelectedIndexChanged事件不会触发。第二个更改将完全清除下拉列表

下拉列表中的项目是在页面第一次加载为添加到控件的items集合的simple ListItems时创建的。这些值是从Microsoft CRM系统检索的,但不是数据绑定

有谁能解释一下哪里出了问题,为什么Visual Studio中的行为会与直播时的行为不同

    protected void Page_Load(object sender, EventArgs e)
    {
        _crm = GetCrmConnection();

        if (!IsPostBack)
        {
            ShowDepotList();
            ShowJobsForCurrentDepot(); // Updates the grid - not shown in SO
        }
    }


    private void ShowDepotList()
    {
        List<BusinessEntity> depots = _crm.GetDepots();
        foreach (DynamicEntity depot in depots)
        {
            string depotName = depot.Properties["dpt_name"].ToString();
            string locationName = depot.Properties["dpt_locationname"].ToString();

            ListItem depotListItem = new ListItem
            {
                Text = string.Format("{0} - {1}", depotName, locationName),
                Value = ((Key)depot.Properties["dpt_sitedetailid"]).Value.ToString()
            };

            DepotInput.Items.Add(depotListItem);
        }
   }


   protected void DepotInput_SelectedIndexChanged(object sender, EventArgs e)
   {
        ShowJobsForCurrentDepot();
   }
受保护的无效页面加载(对象发送方,事件参数e)
{
_crm=GetCrmConnection();
如果(!IsPostBack)
{
ShowDepotList();
ShowJobsForCurrentDepot();//更新网格-SO中未显示
}
}
私有void ShowDepotList()
{
列出仓库=_crm.GetDepots();
foreach(车辆段中的动态车辆段)
{
字符串depotName=depot.Properties[“dpt_name”].ToString();
字符串locationName=depot.Properties[“dpt_locationName”].ToString();
ListItem depotListItem=新建ListItem
{
Text=string.Format(“{0}-{1}”,depotName,locationName),
Value=((键)depot.Properties[“dpt_sitedetailid”]).Value.ToString()
};
DepotInput.Items.Add(depotListItem);
}
}
受保护的void DepotInput\u SelectedIndexChanged(对象发送方,事件参数e)
{
ShowJobsForCurrentDepot();
}

如果您确定测试机器和实时机器上的代码相同-您确定web.config也相同吗

您可以在web.config中打开和关闭ViewState:

<pages enableViewState="false" />


您可能在开发时打开了它,但在live web.config上关闭了它。

如果您确定测试机器和live机器上的代码相同,那么您确定web.config也相同吗

您可以在web.config中打开和关闭ViewState:

<pages enableViewState="false" />

您可能在开发时打开了它,但在live web.config上关闭了它