Check if value of textbox extended with MaskedEditExtender is valid?

Posted by Ismail S on Stack Overflow See other posts from Stack Overflow or by Ismail S
Published on 2010-05-19T05:30:43Z Indexed on 2010/05/19 5:40 UTC
Read the original article Hit count: 405

Below is my code:

<asp:TextBox 
  ID="FromDateTextBox" 
  runat="server" />
<asp:ImageButton 
  ID="FromDateImageButton" 
  runat="server" 
  ImageUrl="~/images/calander.png" />
<ajaxkit:CalendarExtender 
  ID="FromDate" 
  runat="server" 
  TargetControlID="FromDateTextBox" 
  CssClass="CalanderControl" 
  PopupButtonID="FromDateImageButton" 
  Enabled="True" />                
<ajaxkit:MaskedEditExtender 
  id="FromDateMaskedEditExtender" 
  runat="server" 
  targetcontrolid="FromDateTextBox" 
  Mask="99/99/9999" 
  messagevalidatortip="true" 
  onfocuscssclass="MaskedEditFocus" 
  oninvalidcssclass="MaskedEditError" 
  masktype="Date" 
  displaymoney="Left" 
  acceptnegative="Left" 
  errortooltipenabled="True" />
<ajaxkit:MaskedEditValidator 
  id="FromDateMaskedEditValidator" 
  runat="server" 
  controlextender="FromDateMaskedEditExtender" 
  controltovalidate="FromDateTextBox" 
  emptyvaluemessage="Date is required" 
  invalidvaluemessage="Date is invalid" 
  display="Dynamic"
  tooltipmessage="Input a date" 
  emptyvalueblurredtext="*" 
  invalidvalueblurredmessage="*"
  validationgroup="MKE" />

I've set Culture="auto" UICulture="auto" in @Page directive and EnableScriptGlobalization="true" EnableScriptLocalization="true" in script manager to have client culture specific date format in my textbox.

I also have a Go button on my page on which I will do a partial post back. So, I want to validate the FromDateTextBox in javascript when the Go button is clicked.

© Stack Overflow or respective owner

Related posts about ajaxcontroltoolkit

Related posts about ASP.NET