按钮点击控制不转到Sub

时间:2017-07-26 15:35:08

标签: asp.net vb.net

我有按钮id = btnUploadxml,如图所示;

<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子,但是一些如何给我错误

  

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

请建议!!

1 个答案:

答案 0 :(得分:0)

尝试将此代码放入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.