Bonjour,

j'essaye de remplir 2 textbox en selectionnant une date du control calendar,ensuite je compare entre les 2 valeur en utilisant un compreValidaor,

voila mon fichier aspx

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
          <tr>
            <td valign="top">Date de début :</td>
            <td valign="top" class="style2" ><asp:TextBox ID="txtbeginDate" Runat="server" CssClass="textEntry" Enabled="false"/></td>
            <td valign="top" class="style5"><asp:ImageButton  ID="ImageButton1" ImageUrl="img/img_Calendar.gif" Height="20px" runat="server" onclick="btnCalendar_Click" /></td>
            </tr>
            <tr><td></td>
            <td colspan="2" align="left" valign="top">
            <asp:calendar Width="100%"  id="Calendar1" Visible="false"  runat="server" ondayrender="On_Dayrender" onselectionchanged="Calendar1_SelectionChanged">
            <TodayDayStyle Font-Names="Arial" Font-Bold="True" ForeColor="Red"></TodayDayStyle>
	            <SelectorStyle Font-Names="Arial"></SelectorStyle>  
                <DayStyle Font-Names="Arial" ForeColor="#006600"></DayStyle>
	            <NextPrevStyle Font-Names="Arial" ForeColor="White" BorderColor="#000600" BackColor="#006600"></NextPrevStyle>
	            <DayHeaderStyle Font-Names="Arial" ForeColor="White" BorderColor="#006600" BackColor="#006600"></DayHeaderStyle>
	            <SelectedDayStyle Font-Names="Arial"></SelectedDayStyle>
                <TitleStyle Font-Names="Arial" ForeColor="White" BorderColor="#006600" BackColor="#006600"></TitleStyle>
	            <WeekendDayStyle Font-Names="Arial"></WeekendDayStyle>
	            <OtherMonthDayStyle Font-Names="Arial" ForeColor="#006600" BorderColor="White" BackColor="White"></OtherMonthDayStyle>
 
            </asp:calendar>
 
                </td>
                </tr>
            <tr>
            <td valign="top">Date de fin:</td>
            <td valign="top" class="style2" ><asp:TextBox ID="txtENdDate" Runat="server" Enabled="false" CssClass="textEntry"/>
            <td valign="top" class="style5"><asp:ImageButton  ID="ImageButton2" ImageUrl="img/img_Calendar.gif" Height="20px" runat="server" onclick="btnCalendar1_Click" />
            </td>
            </tr>
            <tr>
            <td></td>
            <td colspan="2" align="left" valign="top">
            <asp:calendar Width="100%" id="Calendar2" Visible="false"  runat="server"  ondayrender="On_Dayrender" onselectionchanged="Calendar2_SelectionChanged">
	            <TodayDayStyle Font-Names="Arial" Font-Bold="True" ForeColor="Red"></TodayDayStyle>
	            <SelectorStyle Font-Names="Arial"></SelectorStyle>  
                <DayStyle Font-Names="Arial" ForeColor="#006600"></DayStyle>
	            <NextPrevStyle Font-Names="Arial" ForeColor="White" BorderColor="#000600" BackColor="#006600"></NextPrevStyle>
	            <DayHeaderStyle Font-Names="Arial" ForeColor="White" BorderColor="#006600" BackColor="#006600"></DayHeaderStyle>
	            <SelectedDayStyle Font-Names="Arial"></SelectedDayStyle>
                <TitleStyle Font-Names="Arial" ForeColor="White" BorderColor="#006600" BackColor="#006600"></TitleStyle>
	            <WeekendDayStyle Font-Names="Arial"></WeekendDayStyle>
	            <OtherMonthDayStyle Font-Names="Arial" ForeColor="#006600" BorderColor="White" BackColor="White"></OtherMonthDayStyle>
            </asp:calendar>
 
            </td>
            </tr>
             <tr><td></td>
             <td colspan="2"><asp:CompareValidator runat="server" id="cmpNumbers" controltovalidate="txtENdDate" controltocompare="txtbeginDate" operator="GreaterThanEqual" type="Date" errormessage="End Date must be greater than or equal to Start Date!" /></td>
             </tr>
le validator gere bien les valeurs,mais le probleme c'est j'arrive pas à selectionner un date en cas d'erreur, parceque le contol bloque tout accés au serveur. il ya pas moyen d'afficher le calendar en appyant sur le button parceque il'est desactivé par le compare validator

des idées???