【问题标题】:On button click control not going to Sub [duplicate]按钮单击控件不会转到子 [重复]
【发布时间】:2017-07-26 15:35:07
【问题描述】:

我有带有 id = btnUploadxml 的 Button,如图所示;

<td>
   <div id="divUpload" runat="server">
      <asp:FileUpload ID="FileUpload1" runat="server" 
           style="font-family: Tahoma, Verdana, Arial, Helvetica, MS Sans Serif;font-size: 9pt; font-weight:bolder;" 
           BackColor="White" ForeColor="Black" Height="50px" 
           CssClass="ceva-form-btn btn-dialog" Width="458px" />              
      <asp:Button  Text="Import File" runat="server" ID="btnUploadxml"   />
      <br />
      <br />
    </div>
</td>

点击按钮后,控制应该转到

 Public Sub btnUploadxml_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUploadxml.Click

    If Not FileUpload1.HasFile Then
        ErImport.Text = "ErImport, File required"
        ErImport.Visible = "True"
        'UIValidator.AddErrorSummary("", "Select file to import", "File required")

点击控件上的应该转到我的btnUploadxml_Click sub,但是它给了我一些错误

“System.InvalidOperationException:由于对象的当前状态,操作无效。”。

请指教!!

【问题讨论】:

  • 你有很多表单域吗?也许你需要increase the limit
  • 你是对的,在增加限制后它对我来说很好..谢谢!!

标签: asp.net vb.net


【解决方案1】:

尝试将这段代码放入您的 web.config 文件中:

<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="2001" />
</appSettings>

您将覆盖默认值 1000。尝试 2001 或更大的值。 这个值的定义是这样的:

 aspnet:MaxHttpCollectionKeys

Limits the maximum number of items that can be present in any of the client-   provided dictionaries of the HttpRequest object.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-30
    • 1970-01-01
    • 2016-02-16
    • 1970-01-01
    • 2017-01-18
    • 2012-10-16
    相关资源
    最近更新 更多