happyslug

happyslug

  • NA
  • 11
  • 0

Field Validators and Post backs

Oct 4 2011 7:22 AM
I have a form which is mainly standard controls and an asp:table which I build in code


It all works fine until I start using field validators

Once I do on clicking my Save button, it performs the validation and shows the validationsummary - BUT this also involves a Post back - so the asp:table is wiped out.


Here is my Save button

<asp:ImageButton ID="BtnClientSave" runat="server" ValidationGroup="Servicegrp" ImageUrl="~/Images/Save.png"
                                OnClientClick="return BtnSaveClick()" OnClick="BtnClientSaveClick" Style="display: none" />
                           

and my validation summary

<asp:ValidationSummary ID="valSummary" runat="server" DisplayMode="BulletList" ShowSummary="true"
                                ShowMessageBox="false" HeaderText="" ValidationGroup="Servicegrp" />



An example range validator

<asp:RangeValidator ID="rgeCurrentlyUnemployed" runat="server" ErrorMessage="Please Select an Unemployment Status"
                                            Text="*" ControlToValidate="ddlCurrentlyUnemployed" MaximumValue="999999" MinimumValue="1"
                                            ValidationGroup="Servicegrp"></asp:RangeValidator>



and my table

<asp:Table ID="QuestionTable" runat="server">
</asp:Table>




Answers (6)