Admin Admin
Mesaj Sayısı : 72 Kayıt tarihi : 02/12/08
| Konu: seçilen zamana göre Calendarın gün ay hafta renklerinin değiştirilmesi Cuma Ara. 05, 2008 3:49 pm | |
| Formumuza Bir Adet Calendar ve Bir adet label ekliyoruz. Default.aspx - Kod:
-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <h3><font face="Verdana">seçilen zamana göre Calendarın gün ay hafta renklerinin değiştirilmesi</font></h3> <p>
<form id="Form1" runat="server">
<p> <asp:Calendar id="Calendar1" runat="server" onselectionchanged="Date_Selected" DayNameFormat="Short" SelectionMode="DayWeekMonth" Font-Names="Verdana;Arial" Font-Size="12px" Height="180px" Width="230px" TodayDayStyle-Font-Bold="True" DayHeaderStyle-Font-Bold="True" OtherMonthDayStyle-ForeColor="gray" TitleStyle-BackColor="#3366ff" TitleStyle-ForeColor="white" TitleStyle-Font-Bold="True" SelectedDayStyle-BackColor="#ffcc66" SelectedDayStyle-Font-Bold="True" NextPrevFormat="ShortMonth" NextPrevStyle-ForeColor="white" NextPrevStyle-Font-Size="10px" SelectorStyle-BackColor="#99ccff" SelectorStyle-ForeColor="navy" SelectorStyle-Font-Size="9px" SelectWeekText = "week" SelectMonthText = "month" />
<p> <asp:Label id="Label1" runat="server" /> </form> </body> </html>
Default.aspx.cs - Kod:
-
using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
} protected void Date_Selected(object sender, EventArgs e) { switch (Calendar1.SelectedDates.Count) {
case (0): //None Label1.Text = "Hiç bir gün seçmediniz"; break; case (1): //Day Label1.Text = "seçtiğiniz tarih " + Calendar1.SelectedDate.ToShortDateString(); break; case (7): //Week Label1.Text = "seçtiğiniz hafta " + Calendar1.SelectedDate.ToShortDateString(); break; default: //Month Label1.Text = "seçtiğiniz ay " + Calendar1.SelectedDate.ToShortDateString(); break; }
}
}
Projemizi çalştırdığımız zaman sol taraftaki linlere tıkladığımızda renklerin değiştiğini göreceksini.İyi çalışmalar. | |
|