c# - Validation in GridView not working for TextBox in EditItemTemplate -


I am trying to add a RegularExpressionValidator to a text box in a Am EditItemTemplate in a GridView control.

When a user clicks on "Update", the input is incorrect, the verifier's work (error message is showing). But, in the OnRowUpdating method, I have the page. ISIIDID is == true . Why is it happening

ASPX code:

  & lt; ASP: GridView id = "dgvsaldoPV" runat = "server" view = "false" AutoGenerateColumns = "false" ShowFooter = "True" AllowSorting = "True" OnSorting = "TaskGridView_SortingSaldoPV" OnRow Edit = "gv1_RowEditing" OnRowUpdating = "gv1_RowUpdating" onRowCancelingEdit = "Gv1_RowCancelingEdit" DataKeyNames = "ID_CASSA" & gt; & Lt; AlternatingRowStyle BackColor = "#FFFFCC" / & gt; & Lt; Columns & gt; & Lt; Asp: TemplateField HeaderText = "insert" = "incorrect" sorted expression = "saldo" & gt; & Lt; EditItemTemplate & gt; & Lt; Asp: TextBox ID = "txtsaldo" runat = "server" validationgroup = "saldo" text = '& lt;% # bound ( "SALDO")% & gt;' & Gt; & Lt; / ASP: text box & gt; & Lt; ASP: RegularExpressionValidator id = "RegularExpressionValidator1" runat = "server" ControlToValidate = "txtsaldo" Error = "Inserisci valori numerici, Usare ',' per i decimali" ValidationExpression = "^ \ d * \, \ d + $?" Validationgroup = "Soldo" ForeColor = "Red" & gt; & Lt; / Asp: RegularExpressionValidator & gt; & Lt; / EditItemTemplate & gt; & Lt; Itemmetlet & gt; & Lt; ASP: Labels ID = "LABEL1" runat = "server" text = '& lt;% # binding ("SALDO")% & gt; & Gt; & Lt; / ASP: Labels & gt; & Lt; / ItemTemplate & gt; & Lt; Item style CssClass = "style11" /> & Lt; / ASP: TemplateField & gt; & Lt; Asp: CommandField ShowEditButton = "True" ShowHeader = "false" Header Style-CSS Class = "Header Style 1" /> & Lt; / Column & gt; & Lt; FooterStyle BackColor = "# CC0000" ForeColor = "White" /> & Lt; Header style CssClass = "Header Styles" /> & Lt; RowStyle horizontal alliance = "center" vertical alliance = "center" /> & Lt; / ASP: GridView & gt;    

Try calling

  Page.Validate ( );  GridView.RowUpdating  at the beginning of the event   

This will inspire testing of all server side vendors. I hope it was already called at that point, but it seems that this is not the case.

If you GridView a UpdatePanel to a partial postback, or postback has not been set for the recognition of the controls that appear in the fire ( this . reasons of legitimacy has been set false property), I Page.IsValid property is not yet populated.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -