Question ValidatorCalloutExtender fires on the second try?

raysefo

Well-known member
Joined
Jul 21, 2010
Messages
207
Programming Experience
Beginner
Hi,


I have a comparevalidator which is used for a textbox. This comparevalidator supposed to work when user clicks submit button. But it fires on the second try.

Here is the code.

<asp:TextBox runat="server" ID="TextBox_baslangict" Text=""></asp:TextBox>
<asp:CalendarExtender ID="TextBox_baslangict_CalendarExtender" runat="server" TargetControlID="TextBox_baslangict"
Format="dd/MM/yyyy">
</asp:CalendarExtender>

<asp:CompareValidator ID="CompareValidator3" runat="server" ControlToValidate="TextBox_baslangict"
Text='<img src="Images/validation_error.png">' Operator="GreaterThanEqual" Font-Bold="True"
SetFocusOnError="True" Display="None"></asp:CompareValidator>

<asp:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender9" Width="200px"
TargetControlID="CompareValidator3" HighlightCssClass="highlight">
</asp:ValidatorCalloutExtender>


Here is the vb portion
Protected Sub Button_OK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_OK.Click

If DropDownList_it.SelectedIndex = 0 Then
CompareValidator3.Type = ValidationDataType.Date
CompareValidator3.ControlToCompare = TextBox1.ID

If TextBox_baslangict.Text < TextBox1.Text Then
Select Case Thread.CurrentThread.CurrentCulture.Name
Case "tr-TR"
CompareValidator3.ErrorMessage = " Başlangıç Tarihi Bugünün Tarihinden Küçük Olamaz!"
Case "en-US"
CompareValidator3.ErrorMessage = " Start Date Should NOT be Smaller Than Today!"
End Select
ValidatorCalloutExtender9.TargetControlID = CompareValidator3.ID

Exit Sub
End If

....

The problem is validatorcalloutextender fires when i click this Button_OK twice.

Any help please

Thanks in advance.


Best Regards
 
Back
Top