首页 > 解决方案 > Internet Explorer 无法识别小数点

问题描述

我开发了一个用 C# 编写的 aspx Web 应用程序,您可以在其中运行公式。用户可以输入数字,它们将被转移到 SQL 表中。

现在,一位用户注意到,当他在 Internet Explorer 中使用应用程序并输入像“5.5”这样的十进制数字时,应用程序无法识别小数点并显示“55”。在 Mozilla Firefox 中,它以正确的方式工作。

由于很多用户经常使用 IE,我想解决这个问题。我用谷歌搜索了一下,但没有发现任何类似的问题。有谁知道为什么它不能在 IE 上运行?

当前版本的 IE 是 11。

感谢您的帮助和回答!先感谢您!

编辑:文本框id="shiftValue"是输入金额的地方,请参见下面的主代码

主站点:

<!-- ################################ add budgetshifts Site ##########################################-->

      <div id="input" class="maincontainer" runat="server" Visible="false">
        <br>
        <asp:RadioButton id="radio_budgetshift" runat="server" AutoPostBack="True" Checked="True" GroupName="Sender" Text="BudgetShift" TextAlign="Right" OnCheckedChanged ="radioChange" />
        <asp:RadioButton id="radio_extrabudget" runat="server" AutoPostBack="True" Checked="False" GroupName="Sender" Text="ExtraBudget" TextAlign="Right" OnCheckedChanged ="radioChange" />
        <asp:RadioButton id="radio_masterplanbudgetshift" runat="server" AutoPostBack="True" Checked="False" GroupName="Sender" Text="MasterPlan BudgetShift" TextAlign="Right" OnCheckedChanged ="radioChange" />
        <br><br>
        <asp:CheckBox id="planCheck" runat="server" AutoPostBack="False" Text="Planung" TextAlign="Right" Checked="True" />
        <asp:CheckBox id="hr04Check" runat="server" AutoPostBack="False" Text="Hochrechnung 04" TextAlign="Right" Checked="False" />
        <asp:CheckBox id="hr08Check" runat="server" AutoPostBack="False" Text="Hochrechnung 08" TextAlign="Right" Checked="False" />
        <br><br>

        <table class="tg">
          <tr>
            <th class="tg-031e"></th>
            <th class="tg-yw4l">From</th>
            <th class="tg-yw4l">To</th>
          </tr>
          <tr>
            <td class="tg-b7b8" />
            <td class="tg-b7b8">
              <asp:TextBox ID="search1" placeholder="Search..." runat="server" />
            </td>
            <td class="tg-b7b8">
              <asp:TextBox ID="search2" placeholder="Search..." runat="server" />
            </td>
          </tr>
          <tr>
            <td class="tg-b7b8" />
            <td class="tg-b7b8">
              <asp:ListBox id="ccListBox1" runat="server" DataTextField="Name" DataValueField="CostCenter" DataSourceID="view_costcenters" width="500px" />
            </td>
            <td class="tg-b7b8">
              <asp:ListBox id="ccListBox2" runat="server" DataTextField="Name" DataValueField="CostCenter" DataSourceID="view_costcenters" width="500px" />
            </td>
          </tr>
          <tr>
            <td class="tg-yw4l" />
            <td class="tg-yw4l">
              <asp:TextBox ID="search3" placeholder="Search..." runat="server" />
            </td>
            <td class="tg-yw4l">
              <asp:TextBox ID="search4" placeholder="Search..." runat="server" />
            </td>
          </tr>
          <tr>
            <td class="tg-yw4l" />
            <td class="tg-yw4l">
              <asp:ListBox id="ctListBox1" runat="server" DataTextField="Name" DataValueField="Kostenart" DataSourceID="SqlDataSource2" width="875px" AutoPostBack="false" />
            </td>
            <td class="tg-yw4l">
              <asp:ListBox id="ctListBox2" runat="server" DataTextField="Name" DataValueField="Kostenart" DataSourceID="SqlDataSource2" width="875px" AutoPostBack="false" />
            </td>
          </tr>
        </table>
        <br>

        <asp:GridView ID="presavedBudgetshifts" runat="server" AutoGenerateColumns="false" class="table1" OnRowDeleting="presavedBudgetshifts_RowDeleting">
          <Columns>
            <asp:BoundField DataField="From" HeaderText="From" />
            <asp:BoundField DataField="To" HeaderText="To" />
            <asp:BoundField DataField="Months" HeaderText="Months" />
            <asp:BoundField DataField="Amount" HeaderText="Amount" />
            <asp:BoundField DataField="Currency" HeaderText="Currency" />
            <asp:BoundField DataField="Reason" HeaderText="Reason" />
            <asp:ButtonField buttontype="Button" commandname="Delete" headertext="Delete" text="Delete" visible="true" />
          </Columns>
        </asp:GridView>

        <p>
          <asp:CheckBoxList id="chkboxlistmonths" DataSourceID="help_months" CellPadding="10" CellSpacing="10" RepeatDirection="Horizontal" RepeatLayout="Flow" TextAlign="Right" runat="server" DataTextField="Text" DataValueField="Number" />
        </p>

        <!-- Select amount and currency -->
        <p>Amount per month: 
          <asp:TextBox id="shiftValue" Columns="40" MaxLength="40" Rows="1"  TextMode="SingleLine" runat="server" AutoPostBack="false" />
          <asp:DropDownList id="DropDownCur" runat="server">
            <asp:ListItem>EUR</asp:ListItem>
            <asp:ListItem>CHF</asp:ListItem>
            <asp:ListItem>GBP</asp:ListItem>
            <asp:ListItem>USD</asp:ListItem>
          </asp:DropDownList>
        </p>
        <br>

        <!-- Reason text -->
        <p>Reason:</p>
        <asp:TextBox id="reasonText" Columns="40" MaxLength="40" Rows="5" TextMode="MultiLine" runat="server" AutoPostBack="False" />
        <br>
        <br>

        <!-- Button additional budgetshift -->
        <asp:Button id="additionalShift" runat="server" Text="+++Add additional budgetshift (with same Costcenters)+++" width="25%" OnClick="addAdditionalShift" />
        <br>
        <br>

        <!-- Upload file -->
        <p>Upload your budgetShift/ExtraBudget document:
          <asp:FileUpload ID="FileUpload1" runat="server" />
        </p>
        <br>

        <!-- Button additional budgetshift -->
        <asp:Button id="refreshDataButton" runat="server" Text="Check Input" OnClick="addAdditionalShift" />
        <asp:Button id="CancelButton" runat="server" OnClick="cancelButton" CommandName="cancelInput" Text="Cancel" />
        <asp:Button id="createButton" runat="server" OnClick="saveShift" Text="Save" />
        <br>
        <br>
      </div>

方法additionalShift:

 void addAdditionalShift(Object Src, EventArgs E) {

    //Checks input
    if(!isInputOk()) {
      return;
    }

    int tmpnumberofshifts = Convert.ToInt32(Session["numberofshifts"]);
    CostType tmpcosttype = new CostType(tmpnumberofshifts);

    //Locks Costcenter, valueType and categorie buttons
    radio_budgetshift.Enabled = false;
    radio_extrabudget.Enabled = false;
    radio_masterplanbudgetshift.Enabled = false;
    planCheck.Enabled = false;
    hr04Check.Enabled = false;
    hr08Check.Enabled = false;
    ccListBox1.Enabled = false;
    ccListBox2.Enabled = false;
    ccListBox1.Attributes.Add("disabled", "true");
    ccListBox2.Attributes.Add("disabled", "true");

    if (tmpnumberofshifts == 0) {
      //Checks type of budget
      if(radio_extrabudget.Checked == true){
        SourceCostCenter.costType = ctListBox1.SelectedItem.Value.ToString();
        SourceCostCenter.costTypeString = getCostTypeInfo(SourceCostCenter.costType);
        SourceCostCenter.costCenterString = getCCInfo(ccListBox1.SelectedItem.Value.ToString());
      } else {
        DestinationCostCenter.costType = ctListBox2.SelectedItem.Value.ToString();
        DestinationCostCenter.costTypeString = getCostTypeInfo(DestinationCostCenter.costType);
        DestinationCostCenter.costCenterString = getCCInfo(ccListBox2.SelectedItem.Value.ToString());
        SourceCostCenter.costType = ctListBox1.SelectedItem.Value.ToString();
        SourceCostCenter.costTypeString = getCostTypeInfo(SourceCostCenter.costType);
        SourceCostCenter.costCenterString = getCCInfo(ccListBox1.SelectedItem.Value.ToString());
      }
    }

    //Checks if extrabudget is selected
    if(radio_extrabudget.Checked == false){
      tmpcosttype.destinationCostType = ctListBox2.SelectedItem.Value.ToString();
    }

    //Gets input
    tmpcosttype.sourceCostType = ctListBox1.SelectedItem.Value.ToString();
    tmpcosttype.amount = Convert.ToDouble(this.shiftValue.Text.ToString());
    tmpcosttype.currency = this.DropDownCur.SelectedItem.Text.ToString();

    tmpcosttype.reason = reasonText.Text.ToString();

    //Saves the selected months
    for (int i=0; i<chkboxlistmonths.Items.Count; i++) {
      if (chkboxlistmonths.Items[i].Selected) {
        tmpcosttype.months.Add(chkboxlistmonths.Items[i].Value);
      }
    }

    tmpnumberofshifts++;

    Session["numberofshifts"] = tmpnumberofshifts;
    ((ArrayList) Session["Array"]).Add(tmpcosttype);

    updateCostTypeToPreShow();
    resetAdditionalShift();
  }

方法saveShift:

  void saveShift(Object Src, EventArgs E) {
    resetErrMsg();

    string thisyear = this.yearLabel.Text;
    string wertart = "";
    string wertart2 = "";
    string wertart3 = "";
    string errmsg = "Inputerror!";

    bool checkedSomething = false;
    bool hasErrors = false;

    int tmpnumberofshifts = Convert.ToInt32(Session["numberofshifts"]);

    if (tmpnumberofshifts == 0) {
      //Wenn kein Shift vorhanden ist, dann füge den aktuellen shift initial hinzu und speicher anschließend
      //dient dazu, wenn nur ein Shift eingetragen wird, dass die gleiche Methode aufgerufen wird, wie wenn es mehrere Shifts gibt
      //dies spart einige Zeilen code, da so nicht zwischen einem und mehreren Shifts unterschieden werden muss und die Speicher-Logik ist somit nur an einer Stelle
      addAdditionalShift(Src, E);
    } else if (tmpnumberofshifts > 0 && isBudgetshiftInputFilled()) {
      //Wenn bereits ein Shift existiert und in dem Inputform etwas eingetragen ist, dann versuche die Daten auch als Additional Shift hinzu zu fügen
      addAdditionalShift(Src, E);
    }

    saveMultipleShifts();

    string selectedCategory1 = "";
    //gets category and sends mail
    if(radio_extrabudget.Checked == true){
      selectedCategory1 = "extrabudget";
    }
    if(radio_budgetshift.Checked == true){
      selectedCategory1 = "budgetshift";
    }
    if(radio_masterplanbudgetshift.Checked == true){
      selectedCategory1 = "budgetshiftMP";
    }

    //Gets valueType for mail
    if(planCheck.Checked == true){
      ((User) Session["user"]).valueType.Add("Planung");
    }
    if(hr04Check.Checked == true) {
      ((User) Session["user"]).valueType.Add("Hochrechnung 04");
    }
    if(hr08Check.Checked == true) {
      ((User) Session["user"]).valueType.Add("Hochrechnung 08");
    }

    this.sendMail(selectedCategory1);

    GridView1.DataBind();

    //Resets all relevant attributes and classes
    resetUserInputValues();
    resetAdditionalShift();
    resetCostTypeList();
    resetInputForm();
    resetSourceCCInfo();
    resetDestinationCCInfo();

    this.input.Visible = false;
    this.window.Visible = true;
    this.hoovermenu.Visible = true;
  }

标签: asp.netinternet-explorer-11decimal-point

解决方案


推荐阅读