Friday, March 25, 2011

MaskedEditExtender - Ajax Control Use in asp.net


<asp:TextBox ID="txt_DOB" runat="server"></asp:TextBox>
                                     
<cc1:CalendarExtender ID="txt_DOB_CalendarExtender" runat="server"                         Enabled="True" PopupButtonID="imgBtnCalender" TargetControlID="txt_DOB">                    </cc1:CalendarExtender>
                                     
<cc1:MaskedEditExtender ID="txt_DOB_MaskedEditExtender" runat="server"
AcceptNegative="Left" CultureAMPMPlaceholder=""                     CultureCurrencySymbolPlaceholder="" CultureDateFormat=""                        CultureDatePlaceholder="" CultureDecimalPlaceholder="" CultureName="en-US"
CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True"
Mask="99/99/9999" MaskType="Date" TargetControlID="txt_DOB">
</cc1:MaskedEditExtender>
                   
<asp:ImageButton ID="imgBtnCalender" runat="server"
ImageUrl="~/Css/images/calendar-schedulehs.png" />
                  
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="txt_DOB" ErrorMessage="Enter DOB" ValidationGroup="Reg"
Display="Dynamic" SetFocusOnError="True"></asp:RequiredFieldValidator>                   
                  
<asp:RangeValidator ID="Rv_NotGToday" runat="server"
ControlToValidate="txt_DOB" Display="None"                         ErrorMessage="Date Of Birth is not Greater than Today Date ..!" Type="Date"
ValidationGroup="Reg"></asp:RangeValidator> 
                       
<cc1:ValidatorCalloutExtender ID="Rv_NotGToday_ValidatorCalloutExtender"
runat="server" Enabled="True" TargetControlID="Rv_NotGToday">                    </cc1:ValidatorCalloutExtender>

protected void Page_Load(object sender, EventArgs e)
        {
TimeZoneInfo IND_ZONE = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
Rv_NotGToday.MaximumValue = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, IND_ZONE).ToShortDateString();
Rv_NotGToday.MinimumValue = "12/1/1900";
}


No comments:

Post a Comment