我有一个gridview,我正在尝试将boundfield值与textBox值进行比较
<asp:GridView ID="gvLoanUtilization" runat="server" DataKeyNames="P_LoanAccountId,UtilizedAmount"
SkinID="Special2" EnableViewState="true" RowStyle-Wrap="true" ShowFooter="true" OnRowDataBound="gvLoanUtilization_RowDataBound">
<Columns>
<mbs:BoundField DataField="Borrower Name" HeaderText="Borrower Name" HeaderStyle-Font-Bold="true"></mbs:BoundField>
<mbs:BoundField DataField="Guarantor Name" HeaderText="Guarantor Name" HeaderStyle-Font-Bold="true"></mbs:BoundField>
<mbs:BoundField DataField="Group Name" HeaderText="Group Name" HeaderStyle-Font-Bold="true"></mbs:BoundField>
<mbs:BoundField DataField="Program Name" HeaderText="Program Name" HeaderStyle-Font-Bold="true"></mbs:BoundField>
<mbs:BoundField DataField="Loan Officer Name" HeaderText="Loan Officer Name" HeaderStyle-Font-Bold="true"></mbs:BoundField>
<mbs:BoundField DataField="Cycle" HeaderText="Cycle" HeaderStyle-Font-Bold="true"></mbs:BoundField>
<mbs:BoundField DataField="Disbursed Date" HeaderText="Disbursed Date" DataFormatString="{0:dd/MM/yy}" HeaderStyle-Font-Bold="true"></mbs:BoundField>
<mbs:BoundField DataField="Principal Amount" HeaderText="Principal Amount" HeaderStyle-Font-Bold="true"></mbs:BoundField>
<mbs:BoundField DataField="Disbursed Amount" HeaderText="Disbursed Amount" HeaderStyle-Font-Bold="true"></mbs:BoundField>
<asp:TemplateField HeaderText="Utilized" HeaderStyle-HorizontalAlign="Right" HeaderStyle-Font-Bold="true">
<ItemTemplate>
<asp:TextBox onFocus="this.select();" ID="txtUtilizedAmount" runat="server" Text='<%# Bind("UtilizedAmount") %>' Enabled='<%# Eval("P_LoanAccountId") != DBNull.Value %>' MaxLength="7" Width="100px" AutoPostBack="true" OnTextChanged="txtRealizableAmount_TextChanged"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
在后面的代码中,我将检查“已使用”是否大于“本金”
protected override Message Save(){
foreach (GridViewRow gvr in this.gvLoanUtilization.Rows)
{
Double utilizedAmount = DBUtility.ToDouble(((System.Web.UI.WebControls.TextBox)gvr.FindControl("txtUtilizedAmount")).Text);
}
}
我应该怎么做才能在循环中访问边界字段“本金”?