I’m having trouble that when I press update in a gridview within my aspx page it is not going to the method. This is part of my code:
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">
And then within my aspx.cs the method is as follows:
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();
}
I have put a breakpoint and found that this method is being skipped completely.
<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"/>
Hi the problem was that there was vlidation within the same page so the page was getting stuck