I have Textbox with CalendarExtender and RangeValidator for it..But I need that Minimum value for RangeValidator to be selected is Today(DateTime.Now) and Maximum value to be 1/01/2009 .How to do it,can someone write code for it...I tried but I always get some errors..ControlExtender Format is set to this ="d/MM/yyyy"
Page Load
rangevalidator1.minimumvalue = DateTime.Now.ToShortDateString
rangevalidator1.maximumvalue = "1/01/2009"
Here is the answer...and it works perfectly...
Code behing
ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.LoadRangeValidator1.MinimumValue = DateTime.Now.ToString("dd-MM-yyyy")
RangeValidator1.MaximumValue ="30-12-2200"
EndSub
<formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server">
</asp:ScriptManager>
<ajaxToolkit:CalendarExtenderID="CalendarExtender1"runat="server"TargetControlID="TextBox1"Format="dd-MM-yyyy">
</ajaxToolkit:CalendarExtender>
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
<asp:RangeValidatorID="RangeValidator1"runat="server"ErrorMessage="RangeValidator"ControlToValidate="TextBox1"Type="Date"></asp:RangeValidator>
</form>
No comments:
Post a Comment