Introduce DataBase,Asp.net,JavaScript,Xml,Html,Css,Sql,Php,ASP.NET Controls,AJAX,Tools,HTML,CSS,JavaScript,Open Source Project,WPF,.Net Framework,Linq
Top Recommended Hosting

Create Date Calendar as User Control

by the3factory 3/14/2008 6:56:00 PM

Create a Ajax enabled web site and create a Date User Control and copy paste the code listed below into the user control page after that drag and drop the on all the report pages that use Start Date and End Date

UC4.jpguc5.jpg

uc6.jpg

uc7.jpg

Background

User Control

Using the code

User Control copy paste on the ASPX page

Collapse
        <table>
<tr>
<td style="width: 100px">
Start Date</td>
<td style="width: 100px">
</td>
<td style="width: 100px">
End Date</td>
<td style="width: 100px">
</td>
</tr>
<tr>
<td style="width: 100px">
<asp:TextBox ID="_sDateDoublePicker" runat="server"></asp:TextBox></td>
<td style="width: 100px">
<asp:Image ID="_sDoubleImage" runat="server" ImageUrl="~/images/btn_calendar.gif" /></td>
<td style="width: 100px">
<asp:TextBox ID="_eDateDoublePicker" runat="server"></asp:TextBox></td>
<td style="width: 100px">
<asp:Image ID="_eDoubleImage" runat="server" ImageUrl="~/images/btn_calendar.gif" /></td>
</tr>
<tr>
<td style="width: 100px">
<cc1:CalendarExtender ID="_sDoubleCalendarExtender" runat="server"
PopupButtonID="_sDoubleImage"  TargetControlID="_sDateDoublePicker">
</cc1:CalendarExtender>
<cc1:ValidatorCalloutExtender ID="_sDoubleValidatorCalloutExtender" runat="server"
TargetControlID="_sDoubleRegularExpressionValidator"
HighlightCssClass="validatorCalloutHighlight" Width="20px">
</cc1:ValidatorCalloutExtender>
<asp:RegularExpressionValidator ID="_sDoubleRegularExpressionValidator" runat="server"
ControlToValidate="_sDateDoublePicker"
Display="None"
ValidationExpression="^(((0?[1-9]|1[012])/(0?[1-9]|1\d|2[0-8])|(0?[13456789]|1[012])/(29|30)|
(0?[13578]|1[02])/31)/(19|[2-9]\d)\d{2}|0?2/29/((19|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$"
ErrorMessage="<b>Invalid Date</b><br />MM/DD/YYYY"></asp:RegularExpressionValidator></td>
<td style="width: 100px">
</td>
<td style="width: 100px">
<cc1:CalendarExtender ID="_eDoubleCalendarExtender" runat="server"
PopupButtonID="_eDoubleImage"  TargetControlID="_eDateDoublePicker">
</cc1:CalendarExtender>
<cc1:ValidatorCalloutExtender ID="_eDoubleValidatorCalloutExtender" runat="server"
TargetControlID="_eDoubleRegularExpressionValidator"
HighlightCssClass="validatorCalloutHighlight" Width="20px">
</cc1:ValidatorCalloutExtender>
<asp:RegularExpressionValidator ID="_eDoubleRegularExpressionValidator" runat="server"
ControlToValidate="_eDateDoublePicker"
Display="None"
ValidationExpression="^(((0?[1-9]|1[012])/(0?[1-9]|1\d|2[0-8])|(0?[13456789]|1[012])/(29|30)|
(0?[13578]|1[02])/31)/(19|[2-9]\d)\d{2}|0?2/29/((19|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$"
ErrorMessage="<b>Invalid Date</b><br />MM/DD/YYYY">
</asp:RegularExpressionValidator>
<asp:CompareValidator ID="_eDateCompareVal" runat="server"
Display="None"
ErrorMessage="<b>End Date is LessThan Start Date </b>"
ControlToValidate="_sDateDoublePicker"
ControlToCompare="_eDateDoublePicker"
Type="Date"
Operator="LessThan"
/>
<cc1:ValidatorCalloutExtender ID="_seDateValidator" runat="server"
TargetControlID="_eDateCompareVal"
HighlightCssClass="validatorCalloutHighlight" Width="40px"/>
</td>
<td style="width: 100px">
</td>
</tr>        

Related posts

Sign up for PayPal and start accepting credit card payments instantly.


Powered by BlogEngine.NET 1.2.0.0