Tema: calendar
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/12/2004, 08:32
Avatar de Sayra
Sayra
 
Fecha de Ingreso: diciembre-2004
Mensajes: 365
Antigüedad: 19 años, 5 meses
Puntos: 1
calendar

Hola ¿como estan todos?
Bueno yo estoy intentandohacer una aplicación en asp. net con un calendario
y como soy nueva en eso me costado.
Pero bueno al grano mi aplicación consiste en que atraves del calendario se puedan seleccionar fechas y que queden resaltadas de un color dependiendo del tipo de asueto. Hasta alli funciona ,el problemas esta que cuando cambio hacia otro asueto , por ejempo feriado me cambia el color de la seleccion anterior y yo no quiero eso yo quiero que cuando selccione asueto y seleccione fechas en calendario me marca lacelda en verde y la deje asiy cuan marcque feriado y seleccione nuevamente en calendario mela marque de amarillo sin cambiar decolor la seleccion anterior

Abajo le pongo el codigo de aplicaión a ver si alguien ve donde esta el error

<HTML>
<HEAD>
<script runat="server">

Sub Calendar1_SelectionChanged(sender As Object, e As EventArgs)
AddToDates(Calendar1.SelectedDate)

End Sub

Sub AddToDates( newDate As DateTime)
Dim dt As DateTime
Dim dtArrayList As ArrayList
If Not Viewstate("selectedDates") Is Nothing Then
dtArrayList = CType(Viewstate("selectedDates"), ArrayList)
Dim i As Integer
For i = 0 to dtArrayList.Count - 1
dt = CType( dtArrayList(i), DateTime)
Calendar1.SelectedDates.Add( dt )
Next
Else
dtArrayList = New ArrayList()
End If

Calendar1.SelectedDates.Add(newDate)
dtArrayList.Add(newDate)
Viewstate("selectedDates") = dtArrayList
End Sub

Sub Calendar1_DayRender(sender As Object, e As DayRenderEventArgs)



dim AsuetoStyle as New style
AsuetoStyle.BackColor= System.Drawing.Color.green


dim FeriadoStyle as New style
FeriadoStyle.BackColor= System.Drawing.Color.yellow

dim BancarioStyle as New style
BancarioStyle.BackColor= System.Drawing.Color.Blue

Dim d As DateTime
For Each d In Calendar1.SelectedDates

If Radio1.Checked = True and e.Day.IsSelected Then
e.Cell.ApplyStyle(AsuetoStyle)



Elseif Radio2.Checked = True and e.Day.IsSelected Then
e.Cell.ApplyStyle(FeriadoStyle)

Elseif Radio3.Checked = True and e.Day.IsSelected Then
e.Cell.ApplyStyle(BancarioStyle)

End if
next
End Sub

</script>
</HEAD>
<body>
<form id="Form1" runat="server">
<P>
<asp:calendar id="Calendar1" TodayDayStyle-BackColor="Red" SelectedDayStyle-Font-Bold="True" TitleStyle-Font-Size="9px" TitleStyle-Font-Bold="True" TitleStyle-BackColor="gray" OtherMonthDayStyle-ForeColor="gray" DayHeaderStyle-BackColor="gainsboro" Width="35px" Height="30px" Font-Size="8px" Font-Name="verdana" BorderStyle="Solid" ondayrender="Calendar1_DayRender" onselectionchanged="Calendar1_SelectionChanged" runat="server">
<TodayDayStyle BackColor="Red"></TodayDayStyle>
<SelectorStyle BackColor="yellow"></SelectorStyle>
<DayHeaderStyle BackColor="Gainsboro"></DayHeaderStyle>
<TitleStyle Font-Size="9px" Font-Bold="True" BackColor="Gray"></TitleStyle>
<OtherMonthDayStyle ForeColor="Gray"></OtherMonthDayStyle>
</asp:calendar></P>
<P>
<span style="FONT: 8pt verdana"><input id="Radio1" style="BACKGROUND-COLOR: green" type="radio" value="Radio1" name="Mode" runat="server">&nbsp; Asueto<br><input id="Radio2" style="BACKGROUND-COLOR: yellow" type="radio" value="Radio2" name="Mode" runat="server">&nbsp; Feriado Nacional<br><input id="Radio3" style="BACKGROUND-COLOR: blue" type="radio" value="Radio3" name="Mode" runat="server">&nbsp;
Bancario</span></P>
<P><SPAN style="FONT: 8pt verdana"></SPAN>&nbsp;</P>
<P></P>

<asp:Button ID="Button1" Text="Guardar" Runat="Server"></asp:Button>
</form>
</body>
</HTML>


Ojo el boton guardar aun no le contuido la funcionalidad
Gracias por su tiempo y la ayuda que me puedan prestar