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
C# 自动回写在生产中不起作用_C#_Asp.net_Webforms_Autopostback - Fatal编程技术网

C# 自动回写在生产中不起作用

C# 自动回写在生产中不起作用,c#,asp.net,webforms,autopostback,C#,Asp.net,Webforms,Autopostback,我有几个表单元素在页面加载时隐藏。用户可以在选择单选按钮时取消隐藏表单元素。表单中有两列。一个用于用户,一个用于用户的配偶。默认设置是在页面最初加载时隐藏配偶框 用户框与后面的代码通信良好 如果显示配偶框,则它们不会与代码通信 后面 如果页面被导航离开并返回到(如保存和 返回)如果配偶框未隐藏,它们会进行通信 回到代码背后 在我的本地主机上,文本框与代码隐藏文件通信 取消隐藏后,将执行所需的操作,但将其部署到生产服务器 不要这样做。 ASP <asp:ScriptManager runat

我有几个表单元素在页面加载时隐藏。用户可以在选择单选按钮时取消隐藏表单元素。表单中有两列。一个用于用户,一个用于用户的配偶。默认设置是在页面最初加载时隐藏配偶框

  • 用户框与后面的代码通信良好
  • 如果显示配偶框,则它们不会与代码通信 后面
  • 如果页面被导航离开并返回到(如保存和 返回)如果配偶框未隐藏,它们会进行通信 回到代码背后
  • 在我的本地主机上,文本框与代码隐藏文件通信 取消隐藏后,将执行所需的操作,但将其部署到生产服务器 不要这样做。
  • ASP

    <asp:ScriptManager runat="server" ID="scmMgr1" LoadScriptsBeforeUI="true" 
    AjaxFrameworkMode="Enabled" 
    CompositeScript-ScriptMode="Release" 
    EnableCdn="true" 
    EnableCdnFallback="true" 
    EnableScriptLocalization="true"></asp:ScriptManager> 
    
    <asp:TextBox runat="server" ID="txtCurrentAgeUser" OnTextChanged="txtCurrentAgeUser_OnTextChanged" AutoPostBack="true" Columns="2" />
    <asp:TextBox runat="server" ID="txtCurrentAgeSpouse" OnTextChanged="txtCurrentAgeSpouse_OnTextChanged" AutoPostBack="true" Columns="2" />
    

    您正在使用UpdatePanel?尝试使用它进行测试。

    在浏览器的开发人员工具中检查控制台时,是否出现客户端JavaScript错误?
    protected void HideSpouseFields () {
      txtCurrentAgeSpouse.Visible = false;
    }
    
    protected void ShowSpouseFields () {
      txtCurrentAgeSpouse.Visible = false;
    }
    
    protected void txtCurrentAgeUser_OnTextChanged (object sender, EventArgs e) {
      if (txtRetirementAgeUser.Text.Trim ().Length > 0) {
           txtLifeExpectancyUser.Text = LifeExpectancy (Convert.ToInt16 (txtRetirementAgeUser.Text.Trim ()), rdoGenderUser.SelectedValue).ToString ();
      }
    }
    
    protected void txtCurrentAgeSpouse_OnTextChanged(object sender, EventArgs e) {
      if (txtRetirementAgeSpouse.Text.Trim ().Length > 0) {
          txtLifeExpectancySpouse.Text = LifeExpectancy (Convert.ToInt16 (txtRetirementAgeSpouse.Text.Trim ()), rdoGenderSpouse.SelectedValue).ToString ();
    }
    }