Question : RequiredFieldValidator Cant validate

I have below textbox and a required field validator

i also have two buttons.. but only one of them causes validation and i am not able to figure out why
 
i need for both to cause validation..


thanks.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
//textbox and a required field validator
<asp:TextBox ID="ReceiverPhoneTextBox" runat="server" onFocus="setFormatPhoneReceiver();"
                                                    onkeydown="javascript:backspacerDOWN(this,event, formatPhoneReceiver);" onkeyup="javascript:backspacerUP(this,event, formatPhoneReceiver);"
                                                    CssClass="input"></asp:TextBox><asp:RequiredFieldValidator ID="ReceiverPhoneTextBoxRequiredFieldValidator"
                                                        Display="none" runat="server" ControlToValidate="ReceiverPhoneTextBox" ErrorMessage="Enter Receiver Phone">*</asp:RequiredFieldValidator>


// does not cause validation
<asp:ImageButton ImageUrl="../images/common/Fulfillment.gif" OnMouseOut="this.src='../images/common/Fulfillment.gif';"
            OnMouseOver="this.src='../images/common/Fulfillment_off.gif';" ID="FulFillmentImageButton"
            OnClientClick="escape(); " runat="server" OnClick="FulFillmentImageButton_Click">
        </asp:ImageButton>

// causes validation
<asp:ImageButton ImageUrl="../images/common/Create.gif" OnMouseOut="this.src='../images/common/Create.gif';"
            OnMouseOver="this.src='../images/common/Create_off.gif';" ID="CreateImageButton"
            runat="server" OnClick="CreateImageButton_Click" OnClientClick="escape(); disableCreateImageButton(this);">
        </asp:ImageButton>

Answer : RequiredFieldValidator Cant validate

Try after adding a ValidationGroup property to the markeup of controls:
ValidationGroup="grp1"

e.g.

//textbox and a required field validator
<asp:TextBox ID="ReceiverPhoneTextBox" runat="server" onFocus="setFormatPhoneReceiver();"
                                                   onkeydown="javascript:backspacerDOWN(this,event, formatPhoneReceiver);" onkeyup="javascript:backspacerUP(this,event, formatPhoneReceiver);"
                                                   CssClass="input" ValidationGroup="grp1"></asp:TextBox><asp:RequiredFieldValidator ID="ReceiverPhoneTextBoxRequiredFieldValidator"
                                                       Display="none" runat="server" ControlToValidate="ReceiverPhoneTextBox" ErrorMessage="Enter Receiver Phone" ValidationGroup="grp1">*</asp:RequiredFieldValidator>

// does not cause validation
<asp:ImageButton ImageUrl="../images/common/Fulfillment.gif" OnMouseOut="this.src='../images/common/Fulfillment.gif';"
           OnMouseOver="this.src='../images/common/Fulfillment_off.gif';" ID="FulFillmentImageButton"
           OnClientClick="escape(); " runat="server" OnClick="FulFillmentImageButton_Click" ValidationGroup="grp1">
       </asp:ImageButton>
// causes validation
<asp:ImageButton ImageUrl="../images/common/Create.gif" OnMouseOut="this.src='../images/common/Create.gif';"
           OnMouseOver="this.src='../images/common/Create_off.gif';" ID="CreateImageButton"
           runat="server" OnClick="CreateImageButton_Click" OnClientClick="escape(); disableCreateImageButton(this);" ValidationGroup="grp1">
       </asp:ImageButton>
Random Solutions  
 
programming4us programming4us