繁体   English   中英

ASPX无法从gridview进行方法更新

[英]ASPX Having trouble going to method update from gridview

我遇到麻烦的是,当我在aspx页面内的gridview中按update时,它将无法使用该方法。 这是我的代码的一部分:

Aspx:

<asp:GridView ID="FBGrid" runat="server"  
  AutoGenerateColumns="False" AutoGenerateEditButton="True"  
  OnRowEditing="FBGrid_EditRecord" OnRowCancelingEdit="FBGrid_RowCancelingEdit"  
  CellSpacing="10" OnRowUpdating="FBGrid_UpdateRecord"
  ShowFooter="True" 
  ItemStyle-HorizontalAlign="Right"  
  Height="159px" Width="695px">

然后在我的aspx.cs中,方法如下:

protected void FBGrid_UpdateRecord(object sender, GridViewUpdateEventArgs e)
{
    int x = e.RowIndex;

    Label txtName = FBGrid.Rows[x].FindControl("BankName") as Label;
    Label txtRef = FBGrid.Rows[x].FindControl("NumberofReferencesRequired") as Label;
    Label txtItems = FBGrid.Rows[x].FindControl("MaximumNumberOfItems") as Label;
    Label txtID = FBGrid.Rows[x].FindControl("BankID") as Label;


    int a = Convert.ToInt32(txtID.Text);
    String b = txtName.Text;
    int c = Convert.ToInt32(txtItems.Text);
    int d = Convert.ToInt32(txtRef.Text);

    ForeignBankDetails FB = new ForeignBankDetails(a, b, c, d);
    BusinessLayerHandler.UpdateForeignBanks(FB);
    FillFBGrid();            
}

我放置了一个断点,发现此方法已被完全跳过。

<asp:RegularExpressionValidator style="position: relative; left: -55px;" 
  id="RegularExpressionValidator4" runat="server" ErrorMessage="RegularExpressionValidator" 
  ForeColor="Red" ControlToValidate="ReferenceChoice" ValidationExpression="(^\d*\.?\d*[0-9]+\d*$)|(^[0-9]+\d*\.\d*$)">
    Invalid Numbers
</asp:RegularExpressionValidator>
<asp:RangeValidator runat="server" id="RangeValidator3" controltovalidate="ReferenceChoice"
  type="Double" minimumvalue="0" maximumvalue="999999999999999" ForeColor="Red"
  errormessage="Invalid Range"/>

嗨,问题在于同一页面中存在波动,因此该页面被卡住了

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM