閲覧総計:&counter(); (本日:&counter(today); 昨日:&counter(yesterday);) カレンダ コントロールの祝日・会社休日をピンクで表示する方法を確認した。 DBに祝日・会社休日情報を用意し、カレンダ表示に反映させる。 土日は、カレンダ コントロールのプロパティ設定:WeekendDayStyleのBackColorを LightPinkに設定する事で対応する。 10/08/10 【稼働画面】 #ref(祝日会社休日カレンダ表示.jpg); #ref(Access祝日会社休日データ.jpg); ※会社休日夏休み:8/9(月)〜8/13(金) ※9/23秋分の日は会社出勤日 開発環境:VWD2008 + Access2003 + SQL Server2008 サーバ:ASP.NET3.5 + Access2003 【HolidayRender_ads.aspx】 <%@ Page Language="VB" %> <%@ Import Namespace = "System.Data" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub cal_dayrender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) ads.SelectParameters.Clear() ads.SelectParameters.Add("CalDate", e.Day.Date.ToString("yyyy/MM/dd")) Dim reader As IDataReader = ads.Select(DataSourceSelectArguments.Empty) ' 日付セル(e.Call)毎に繰り返し Do While reader.Read() '祝日・会社休日をLightPinkに e.Cell.BackColor = Drawing.Color.LightPink Loop End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> カレンダの祝日・会社休日ピンク表示 10/08/10<br /> <br /> <asp:AccessDataSource ID="ads" runat="server" DataFile="~/App_Data/AccessDB.mdb" DataSourceMode="DataReader" SelectCommand="SELECT [ID], [Holiday] FROM [CompanyHolidays] WHERE [Holiday] = @CalDate"> </asp:AccessDataSource> <asp:Calendar id="cal" runat="server" DayHeaderStyle-BackColor="#FFCC66" onDayRender="cal_DayRender" ShowGridLines="true" BorderWidth="3" BorderColor="Black" Font-Name="Verdana" Font-Size="10px" TitleStyle-BackColor="#FFCC66" TitleStyle-Font-Size="12px" TitleStyle-Font-Bold="true" DayStyle-VerticalAlign="Top" DayStyle-Height="50px" DayStyle-Width="14%" SelectedDayStyle-BackColor="Navy" ShowNextPrev="True" NextPrevFormat="FullMonth" Width="504px"> <SelectedDayStyle BackColor="#CC5533" /> <WeekendDayStyle BackColor="LightPink" /> <DayStyle VerticalAlign="Top" Height="50px" Width="14%"></DayStyle> <DayHeaderStyle BackColor="#FFCC66"></DayHeaderStyle> <TitleStyle BackColor="#FFCC66" Font-Bold="True" Font-Size="12px"></TitleStyle> </asp:Calendar> <br /> </div> </form> </body> </html> 【参考にしたページ】 なし - 1 -- [[1]] &new{2012-03-13 (火) 08:28:23}; - 1 -- [[1]] &new{2012-03-13 (火) 08:28:25}; - 1 -- [[-1']] &new{2012-03-13 (火) 08:28:26}; -- 1' -- [[1]] &new{2012-03-13 (火) 08:28:27}; - 1 -- [[1]] &new{2012-03-13 (火) 08:28:29}; - 1 -- [[1]] &new{2012-03-18 (日) 03:02:45}; - 1 -- [[1]] &new{2012-03-18 (日) 03:02:48}; - 1 -- [[-1']] &new{2012-03-18 (日) 03:02:49}; -- 1' -- [[1]] &new{2012-03-18 (日) 03:02:50}; - 1 -- [[1]] &new{2012-03-18 (日) 03:02:51}; - 1 -- [[1]] &new{2012-03-18 (日) 14:30:17}; - 1 -- [[1]] &new{2012-03-18 (日) 14:30:20}; - 1 -- [[-1']] &new{2012-03-18 (日) 14:30:21}; -- 1' -- [[1]] &new{2012-03-18 (日) 14:30:22}; - 1 -- [[1]] &new{2012-03-18 (日) 14:30:23}; - 1 -- [[1]] &new{2012-03-18 (日) 14:53:30}; - 1 -- [[1]] &new{2012-03-18 (日) 14:53:33}; - 1 -- [[-1']] &new{2012-03-18 (日) 14:53:34}; -- 1' -- [[1]] &new{2012-03-18 (日) 14:53:35}; - 1 -- [[1]] &new{2012-03-18 (日) 14:53:36}; - 1 -- [[1]] &new{2012-03-19 (月) 09:22:50}; - 1 -- [[1]] &new{2012-03-19 (月) 09:22:53}; - 1 -- [[-1']] &new{2012-03-19 (月) 09:22:54}; -- 1' -- [[1]] &new{2012-03-19 (月) 09:22:55}; - 1 -- [[1]] &new{2012-03-19 (月) 09:22:56}; - 1 -- [[1]] &new{2012-03-19 (月) 09:30:59}; - 1 -- [[1]] &new{2012-03-19 (月) 09:31:02}; - 1 -- [[-1']] &new{2012-03-19 (月) 09:31:03}; -- 1' -- [[1]] &new{2012-03-19 (月) 09:31:04}; - 1 -- [[1]] &new{2012-03-19 (月) 09:31:06}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:14}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:17}; - 1 -- [[-1']] &new{2012-04-19 (木) 19:02:19}; -- 1' -- [[1]] &new{2012-04-19 (木) 19:02:20}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:21}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:42}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:44}; - 1 -- [[-1']] &new{2012-04-19 (木) 19:02:45}; -- 1' -- [[1]] &new{2012-04-19 (木) 19:02:46}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:47}; - 1 -- [[1]] &new{2012-04-27 (金) 16:26:31}; - 1 -- [[1]] &new{2012-04-27 (金) 16:26:35}; - 1 -- [[-1']] &new{2012-04-27 (金) 16:26:36}; -- 1' -- [[1]] &new{2012-04-27 (金) 16:26:37}; - 1 -- [[1]] &new{2012-04-27 (金) 16:26:38}; - 1 -- [[1]] &new{2012-06-28 (木) 23:39:56}; - 1 -- [[1]] &new{2012-06-28 (木) 23:40:00}; - 1 -- [[-1']] &new{2012-06-28 (木) 23:40:01}; -- 1' -- [[1]] &new{2012-06-28 (木) 23:40:02}; - 1 -- [[1]] &new{2012-06-28 (木) 23:40:04}; - 1 -- [[1]] &new{2014-01-31 (金) 09:27:09}; - 1 -- [[1]] &new{2014-01-31 (金) 09:27:16}; - 1 -- [[-1']] &new{2014-01-31 (金) 09:27:18}; -- 1' -- [[1]] &new{2014-01-31 (金) 09:27:20}; - 1 -- [[1]] &new{2014-01-31 (金) 09:27:22}; #comment_nospam - 1 -- [[1]] &new{2014-01-31 (金) 09:27:14}; - 1 -- [[1]] &new{2012-06-28 (木) 23:39:58}; - 1 -- [[1]] &new{2012-04-27 (金) 16:26:34}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:43}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:16}; - 1 -- [[1]] &new{2012-03-19 (月) 09:31:00}; - 1 -- [[1]] &new{2012-03-19 (月) 09:22:52}; - 1 -- [[1]] &new{2012-03-18 (日) 14:53:32}; - 1 -- [[1]] &new{2012-03-18 (日) 14:30:19}; - 1 -- [[1]] &new{2012-03-18 (日) 03:02:47}; - 1 -- [[1]] &new{2012-03-13 (火) 08:28:24}; #vote(参考になった[4],ふつう[0],参考にならなかった[2]) ~ ~ ~ ●AccessDataSourceコントロールを用いずDBに直接アクセスしたコード 【HolidayRender_direct.aspx】 <%@ Page Language="VB" %> <%@ Import Namespace="System.Data.Common" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> 'MS-AccessDBのConnectionString Dim MyDbConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\AccessDB.mdb;Persist Security Info=True" 'MS-AccessDBのProviderName Dim MyDbProviderName As String = "System.Data.OleDb" ' カレンダのそれぞれの日付セルをレンダリングするタイミングで実行 Sub cal_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Dim setting As ConnectionStringSettings = _ ConfigurationManager.ConnectionStrings(MyDbConnectionString) Dim factory As DbProviderFactory = _ DbProviderFactories.GetFactory(MyDbProviderName) Using db As DbConnection = factory.CreateConnection() db.ConnectionString = MyDbConnectionString ' 出力する日付セルに対応するスケジュール情報を抽出 Dim comm As DbCommand = factory.CreateCommand() comm.CommandText = "SELECT [ID],[Holiday] FROM [CompanyHolidays] WHERE [Holiday]=@CalDate" comm.Connection = db Dim param As DbParameter = factory.CreateParameter() param.ParameterName = "@CalDate" param.Value = e.Day.Date.ToString("yyyy/MM/dd") comm.Parameters.Add(param) db.Open() Dim reader As DbDataReader = comm.ExecuteReader() ' 日付セル(e.Call)毎に繰り返し Do While reader.Read() '祝日・会社休日をLightPinkに e.Cell.BackColor = Drawing.Color.LightPink Loop End Using End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> カレンダの祝日・会社休日をピンク表示(DB直接アクセス法) 10/08/10<br /> <br /> <asp:Calendar id="cal" runat="server" DayHeaderStyle-BackColor="#FFCC66" onDayRender="cal_DayRender" ShowGridLines="true" BorderWidth="3" BorderColor="Black" Font-Name="Verdana" Font-Size="10px" TitleStyle-BackColor="#FFCC66" TitleStyle-Font-Size="12px" TitleStyle-Font-Bold="true" DayStyle-VerticalAlign="Top" DayStyle-Height="50px" DayStyle-Width="14%" SelectedDayStyle-BackColor="Navy" ShowNextPrev="True" NextPrevFormat="FullMonth" Width="504px"> <SelectedDayStyle BackColor="#CC5533" /> <WeekendDayStyle BackColor="LightPink" /> <DayStyle VerticalAlign="Top" Height="50px" Width="14%"></DayStyle> <DayHeaderStyle BackColor="#FFCC66"></DayHeaderStyle> <TitleStyle BackColor="#FFCC66" Font-Bold="True" Font-Size="12px"></TitleStyle> </asp:Calendar> <br /> </div> </form> </body> </html> 【参考にしたページ】 なし - 1 -- [[1]] &new{2012-03-13 (火) 08:28:47}; - 1 -- [[1]] &new{2012-03-13 (火) 08:28:49}; - 1 -- [[-1']] &new{2012-03-13 (火) 08:28:50}; -- 1' -- [[1]] &new{2012-03-13 (火) 08:28:51}; - 1 -- [[1]] &new{2012-03-13 (火) 08:28:52}; - 1 -- [[1]] &new{2012-03-18 (日) 03:03:09}; - 1 -- [[1]] &new{2012-03-18 (日) 03:03:11}; - 1 -- [[-1']] &new{2012-03-18 (日) 03:03:12}; -- 1' -- [[1]] &new{2012-03-18 (日) 03:03:13}; - 1 -- [[1]] &new{2012-03-18 (日) 03:03:14}; - 1 -- [[1]] &new{2012-03-18 (日) 14:30:41}; - 1 -- [[1]] &new{2012-03-18 (日) 14:30:43}; - 1 -- [[-1']] &new{2012-03-18 (日) 14:30:44}; -- 1' -- [[1]] &new{2012-03-18 (日) 14:30:45}; - 1 -- [[1]] &new{2012-03-18 (日) 14:30:46}; - 1 -- [[1]] &new{2012-03-18 (日) 14:53:55}; - 1 -- [[1]] &new{2012-03-18 (日) 14:53:57}; - 1 -- [[-1']] &new{2012-03-18 (日) 14:53:58}; -- 1' -- [[1]] &new{2012-03-18 (日) 14:54:00}; - 1 -- [[1]] &new{2012-03-18 (日) 14:54:01}; - 1 -- [[1]] &new{2012-03-19 (月) 09:23:13}; - 1 -- [[1]] &new{2012-03-19 (月) 09:23:15}; - 1 -- [[-1']] &new{2012-03-19 (月) 09:23:17}; -- 1' -- [[1]] &new{2012-03-19 (月) 09:23:18}; - 1 -- [[1]] &new{2012-03-19 (月) 09:23:19}; - 1 -- [[1]] &new{2012-03-19 (月) 09:31:24}; - 1 -- [[1]] &new{2012-03-19 (月) 09:31:27}; - 1 -- [[-1']] &new{2012-03-19 (月) 09:31:28}; -- 1' -- [[1]] &new{2012-03-19 (月) 09:31:29}; - 1 -- [[1]] &new{2012-03-19 (月) 09:31:31}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:39}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:41}; - 1 -- [[-1']] &new{2012-04-19 (木) 19:02:42}; -- 1' -- [[1]] &new{2012-04-19 (木) 19:02:43}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:45}; - 1 -- [[1]] &new{2012-04-19 (木) 19:03:05}; - 1 -- [[1]] &new{2012-04-19 (木) 19:03:07}; - 1 -- [[-1']] &new{2012-04-19 (木) 19:03:08}; -- 1' -- [[1]] &new{2012-04-19 (木) 19:03:09}; - 1 -- [[1]] &new{2012-04-19 (木) 19:03:10}; - 1 -- [[1]] &new{2012-04-27 (金) 16:26:58}; - 1 -- [[1]] &new{2012-04-27 (金) 16:27:00}; - 1 -- [[-1']] &new{2012-04-27 (金) 16:27:01}; -- 1' -- [[1]] &new{2012-04-27 (金) 16:27:03}; - 1 -- [[1]] &new{2012-04-27 (金) 16:27:04}; - 1 -- [[1]] &new{2012-06-28 (木) 23:40:24}; - 1 -- [[1]] &new{2012-06-28 (木) 23:40:27}; - 1 -- [[-1']] &new{2012-06-28 (木) 23:40:28}; -- 1' -- [[1]] &new{2012-06-28 (木) 23:40:29}; - 1 -- [[1]] &new{2012-06-28 (木) 23:40:31}; - 1 -- [[1]] &new{2014-01-31 (金) 09:28:30}; - 1 -- [[1]] &new{2014-01-31 (金) 09:28:36}; - 1 -- [[-1']] &new{2014-01-31 (金) 09:28:40}; -- 1' -- [[1]] &new{2014-01-31 (金) 09:28:44}; - 1 -- [[1]] &new{2014-01-31 (金) 09:28:48}; - 2015-10-6 xiaozhengm http://www.louisvuitton-lvoutlet.me http://www.louisvuitton.net.co http://www.michaelkors-outletonlines.in.net http://www.ralph-lauren.me.uk http://www.michael-korsoutlets.eu.com http://www.true-religion-outlet.in.net http://www.coach-factoryoutlet.in.net http://www.christianlouboutinoff.us http://www.coach-factoryoutlet.com.co http://www.coachoutlet-storeonline.in.net http://www.hermes-birkin.us http://www.michael-korshandbags.net.co http://www.louis-vuittonhandbags.us http://www.Quality-Outlet.com http://www.cheaplouisvuittonhandbags.org http://www.officialcoachfactoryoutlet.eu.com http://www.jordan8.net http://www.hollisteruksale.me.uk http://www.coachoutlet-storeonline.us.com http://www.cheap-tomsoutlet.us http://www.uggbootoutlet.in.net http://www.coach-factory-outlet-online.us.com http://www.louis-vuittonoutlet.us.com http://www.ralphlauren-uk.me.uk http://www.uggsoutlet.in.net http://www.jordan4.net http://www.michaelkors-outlet.name http://www.authenticlouisvuittonhandbags.net http://uggsaustralia.officialus.net http://www.canadagoose-outlet.us.com http://www.christianlouboutinsell.net http://www.coach-factoryoutlet.cc http://www.outlet-toms.cc http://www.ugg-boots.eu http://www.cheap--nfljerseys.us.com http://www.rayban-sunglasses.com.co http://www.coach-outlet.us.com http://ugg.fairskinmen.com http://www.louisvuittonhandbags.name http://www.coachoutlet-coachfactory.us.com http://www.mont-blancpens.name http://www.michaelkorsoutletclearance.in.net http://www.michaelkorsoutletonline.cc http://www.michael-korshandbags.us http://www.canadagoosejackets.org.uk http://timberlandboots.hugeoff.net http://www.guccioutlet.com.so http://www.sunglass-outlet.us http://www.coachfactoryoutletonline.eu.com http://www.outlet-celine.com http://www.coach-factoryoutlet.eu.com http://www.louisvuittonoutlet.net.co http://burberryoutlet.outoff.com.co http://www.oakleysunglasses-sale.in.net http://www.cheapuggssale.in.net http://www.ugg-boots.eu.com http://www.uggboots-sale.in.net http://www.louisvuitton-handbags.com.co http://www.ugg-boots.net.co http://www.toryburch-outletsale.in.net http://www.jordan3.net http://www.louisvuittonoutlet.name http://www.louisvuittonhandbags.net.co http://www.cheap-jordans.us.com http://www.truereligionjeans-outlet.in.net http://www.kobeshoes.org http://www.abercrombiefitchstore.com http://www.fitflops.org http://www.abercrombie-andfitch.cc http://www.michaelkorsoutletshopping.us.com http://www.lebronjames-shoes.name http://www.michaelkors-outlet.com.co http://www.michaelkorshandbag.org.uk http://www.coachfactoryoutletus.in.net http://www.canadagoose.com.co http://www.michaelkorshandbags.name http://www.michaelkorsoutletonline.name http://www.abercrombiefitchus.com http://www.louisvuitton-outletstores.org http://www.louisvuitton-macys.com http://www.louisvuittonuk.me.uk http://www.toms--shoes.com http://www.hollisters.cc http://www.louis-vuitton-handbags.us.com http://www.louis--vuitton.us http://www.michaelkors-uk.me.uk http://www.michaelkors-outlet.cc http://www.abercrombies.cc http://www.nike-airmax.org.uk http://michaelkors.aphidsymposium.org http://www.coach-factoryoutlet.us.com http://www.michaelkorsoutletvip.in.net http://www.michael-korshandbag.us.com http://www.ralplaurenuk.me.uk http://www.louisvuitton.us.com http://www.michaelkorsbag.org.uk http://www.michael-kors-bags.co.uk http://www.louis-vuitton.us.org http://www.abercrombieandfitch.net.co http://www.michaelkorsoutlet-online.eu.com http://www.michael--korsoutlet.us.com http://www.michaelkorshandbag-uk.co.uk http://www.jordan13.org http://www.rayban-sunglassesuk.co.uk http://www.hollisteruk.in.net http://www.michaelkors-outletonline.eu.com http://www.louisvuitton-inc.com http://www.louisvuitton-outlet.name http://www.jordan6.net http://uggboots.uggaustralia.de.com http://www.niketrainers.com.co http://www.jordans.in.net -- [[xiaozhengm]] &new{2015-10-06 (火) 19:37:31}; #comment_nospam - 1 -- [[1]] &new{2014-01-31 (金) 09:28:33}; - 1 -- [[1]] &new{2012-06-28 (木) 23:40:25}; - 1 -- [[1]] &new{2012-04-27 (金) 16:26:59}; - 1 -- [[1]] &new{2012-04-19 (木) 19:03:06}; - 1 -- [[1]] &new{2012-04-19 (木) 19:02:40}; - 1 -- [[1]] &new{2012-03-19 (月) 09:31:25}; - 1 -- [[1]] &new{2012-03-19 (月) 09:23:14}; - 1 -- [[1]] &new{2012-03-18 (日) 14:53:56}; - 1 -- [[1]] &new{2012-03-18 (日) 14:30:42}; - 1 -- [[1]] &new{2012-03-18 (日) 03:03:10}; - 1 -- [[1]] &new{2012-03-13 (火) 08:28:48}; #vote(参考になった[0],ふつう[0],参考にならなかった[0])