- 追加された行はこの色です。
- 削除された行はこの色です。
閲覧総計:&counter(); (本日:&counter(today); 昨日:&counter(yesterday);)
カレンダ コントロールのセルに情報を表示する方法を確認した。 10/08/09
#ref(SqlCalCellDisp02.jpg);
参考にしたページは↓こちら。
「Calendarコントロールのセルに任意のデータを埋め込むには?」05/03/18
http://www.atmarkit.co.jp/fdotnet/dotnettips/277aspcalceldata/aspcalceldata.html
ところが、DBへの接続手法がASP.NET2.0以降は、記事内容(ASP.NET1.X)から変更にな
っているので、「DBへの接続」のコードを↓記事を参考に全面的に改造した。
「データソース・コントロールでいってみよう(前編)」 06/07/29
http://www.atmarkit.co.jp/fdotnet/vs2005db/vs2005db_06/vs2005db_06_03.html
また、実際にはDBにMS-Accessを利用したいので、↓このページの情報を参考に、
DBをSQL Server2008→MS-Access2003に変更し、正常に稼働する事を確認した。
「ASP.NET アクセスデータにアクセスする(コーディング)」
http://3939deb.seesaa.net/article/107785168.html
また、参考情報としてSqlDataSourceコントロールを利用し実現した場合のコードを掲載
した。コード量が少ない所を比較して欲しい。 10/08/10
★項目をクリックするとそのページに飛べます↓
#contents
開発環境:VWD2008 + Access2003 + SQL Server2008
サーバ:ASP.NET3.5 + Access2003
【機能】DBの予定情報をカレンダに表示する。
*DBにSQL Server2008を使用した場合 [#u32cb928]
【稼働画面】
#ref(SqlScheduleDesign01.JPG);
#ref(SqlScheduleData01.JPG);
#ref(SqlCalCellDisp01.JPG);
【web.configのデータ接続文字列の設定】
SqlServerDBへの接続名として"MySqlServerDB”がweb.configの最初の方の<appSettings>
と<system.web>の間に<connectionStrings>として以下の通り記述されている事を前提とする。
<connectionStrings>
<add name="MySqlServerDB" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\SQLCalendar.mdf;Integrated Security=True;Use r Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
【sqlCalCellDisp.aspx】
<%@ Page Language="VB" ContentType="text/html" %>
<%@ 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">
' それぞれの日付セルをレンダリングするタイミングで実行
Sub cal_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs)
Dim setting As ConnectionStringSettings = _
ConfigurationManager.ConnectionStrings("MySqlServerDB")
Dim factory As DbProviderFactory = _
DbProviderFactories.GetFactory(setting.ProviderName)
Using objDb As DbConnection = factory.CreateConnection()
objDb.ConnectionString = setting.ConnectionString
' 出力する日付セルに対応するスケジュール情報を抽出
Dim objCom As DbCommand = factory.CreateCommand()
objCom.CommandText = "SELECT [ID],[title],[sdate],[stime],[etime] FROM [schedule01] WHERE [sdate]=@sdate ORDER BY [stime] ASC"
objCom.Connection = objDb
Dim objPrm As DbParameter = factory.CreateParameter()
objPrm.ParameterName = "@sdate"
objPrm.Value = e.Day.Date.ToString("yyyy/MM/dd")
objCom.Parameters.Add(objPrm)
objDb.Open()
Dim objRd As DbDataReader = objCom.ExecuteReader()
' 取得したスケジュール情報を基に
' LiteralControl(固定文字列)を生成し、
' 日付セル(e.Call)配下のコントロールとして追加
Do While objRd.Read()
e.Cell.Controls.Add(New LiteralControl("<br />" & String.Format("{0}〜{1}:{2}", objRd.GetString(3), objRd.GetString(4), objRd.G etString(1))))
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>
<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">
<SelectedDayStyle BackColor="#CC5533" />
</asp:Calendar>
<br />
</div>
</form>
</body>
</html>
【参考にしたページ】
1.「Calendarコントロールのセルに任意のデータを埋め込むには?」05/03/18
http://www.atmarkit.co.jp/fdotnet/dotnettips/277aspcalceldata/aspcalceldata.html
2.「データソース・コントロールでいってみよう(前編)」 06/07/29
http://www.atmarkit.co.jp/fdotnet/vs2005db/vs2005db_06/vs2005db_06_03.html
- 1 -- [[1]] &new{2012-03-12 (月) 20:58:28};
- 1 -- [[1]] &new{2012-03-12 (月) 20:58:31};
- 1 -- [[-1']] &new{2012-03-12 (月) 20:58:32};
-- 1' -- [[1]] &new{2012-03-12 (月) 20:58:33};
- 1 -- [[1]] &new{2012-03-12 (月) 20:58:34};
- 1 -- [[1]] &new{2012-04-29 (日) 02:13:59};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:03};
- 1 -- [[-1']] &new{2012-04-29 (日) 02:14:04};
-- 1' -- [[1]] &new{2012-04-29 (日) 02:14:05};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:06};
- 1 -- [[1]] &new{2012-06-29 (金) 17:06:38};
- 1 -- [[1]] &new{2012-06-29 (金) 17:06:42};
- 1 -- [[-1']] &new{2012-06-29 (金) 17:06:43};
-- 1' -- [[1]] &new{2012-06-29 (金) 17:06:44};
- 1 -- [[1]] &new{2012-06-29 (金) 17:06:45};
- 1 -- [[1]] &new{2012-07-13 (金) 18:12:51};
- 1 -- [[1]] &new{2012-07-13 (金) 18:12:54};
- 1 -- [[-1']] &new{2012-07-13 (金) 18:12:55};
-- 1' -- [[1]] &new{2012-07-13 (金) 18:12:56};
- 1 -- [[1]] &new{2012-07-13 (金) 18:12:57};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:02};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:05};
- 1 -- [[-1']] &new{2012-08-26 (日) 21:06:07};
-- 1' -- [[1]] &new{2012-08-26 (日) 21:06:08};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:09};
- 1 -- [[1]] &new{2013-10-21 (月) 11:57:32};
- 1 -- [[1]] &new{2013-10-21 (月) 11:57:41};
- 1 -- [[-1']] &new{2013-10-21 (月) 11:57:46};
-- 1' -- [[1]] &new{2013-10-21 (月) 11:57:48};
- 1 -- [[1]] &new{2013-10-21 (月) 11:57:52};
- 1 -- [[1]] &new{2013-10-25 (金) 15:33:53};
- 1 -- [[1]] &new{2013-10-25 (金) 15:33:59};
- 1 -- [[-1']] &new{2013-10-25 (金) 15:34:01};
-- 1' -- [[1]] &new{2013-10-25 (金) 15:34:02};
- 1 -- [[1]] &new{2013-10-25 (金) 15:34:04};
- セルに表示されません。そのままコピペしたのですが空欄のままです・・・ -- [[かず]] &new{2014-03-11 (火) 02:44:13};
- 1 -- [[1]] &new{2014-05-14 (水) 12:17:01};
- 1 -- [[1]] &new{2014-05-14 (水) 12:20:22};
- 1 -- [[1]] &new{2015-03-15 (日) 14:16:24};
- 1 -- [[-1']] &new{2015-03-15 (日) 14:16:25};
-- 1' -- [[1]] &new{2015-03-15 (日) 14:16:26};
- 1 -- [[1]] &new{2015-03-15 (日) 14:16:27};
- http://www.coachcanadaoutlet.ca http://www.prada-outlet.us http://www.louboutinfemme-pascher.fr http://www.ralphlaurensale.eu.com http://www.jordan3.net http://www.louisvuitton-handbags.com.co http://www.poloralphlaurenhome.net http://www.abercrombie.net.co http://www.holister.name http://www.christian-louboutinoutlet.org http://www.rolexwatchesoutlet.us http://www.abercrombieandfitch.net.co http://www.coachoutletstoreonline.us.org http://www.katespade-outlet.us.com http://www.chanelhandbags.in.net http://www.longchamp-outlet.name http://www.jordan4.net http://www.raybans.name http://www.michaelkorsoutletus.eu.com http://www.louisvuittonoutlets.name http://www.airmax-nike.me.uk http://www.hollisterinc.name http://www.cheaptoms.us http://www.fendi.us.com http://www.michaelkorsoutlet-mk.eu.com http://www.hollister-clothing.net http://www.juicy-couture.us http://www.hollisterclothing.us http://www.pandorajewelry.net.co http://timberlandboots.hugeoff.net http://www.hollisterkids.net http://www.abercrombiestores.net http://www.louisvuittonoutlet-inc.us http://oakley.hugeoff.net http://www.ralph-lauren.net.co http://www.louis-vuitton.us.org http://www.louis--vuitton.us http://lululemon.suleymanaltun.com http://www.marc--jacobs.com http://www.airjordan-pascher.fr http://www.abercrombie.in.net http://www.louisvuitton-lvoutlet.me http://www.guccishoes.us.com http://www.coachoutlet.net.so http://www.michaelkorshandbags.com.so http://www.tory-burchoutlet.in.net http://www.rayban-sunglasses.com.co http://www.retrojordans.name http://www.concords11.com http://www.cheapjordansshoes.in.net http://www.p90xworkouts.us http://truereligion.officialbid.net http://www.guccioutlet.net.co http://burberry.stores.net.co http://www.michaelkorshandbags.eu.com http://www.edhardyclothing.in.net http://www.michaelkorsoutletonlinee.in.net http://www.chiflatiron.com.co http://www.oakleysunglassessale.in.net http://burberryoutlet.officialstore.com.co http://www.coachoutletstoreonline.eu.com http://www.gucci.net.co http://www.abercrombieandfitch.cc http://www.coach-outlet.us.com http://www.michaelkorsoutlet.net.so http://www.cocochaneluk.co.uk http://www.louisvuitton-outlet.us.com http://www.louisvuittonhandbags.net.co http://www.ralph-lauren-outlet.co http://www.louisvuittonuk.me.uk http://www.coach-outlet.us.org http://www.ray-bansunglasses.name http://www.louis-vuitton.net.co http://www.adidasshoes.name http://www.louis-vuittonoutlet.us.org http://www.true-religion-outlet.us.com http://www.michaelkorsonlineoutlet.in.net http://www.jordan13.org http://www.abercrombieoutlet.name http://www.kobeshoes.org http://www.hollister-co.net http://www.holisterclothingstore.com http://www.michaelkorsoutlet.com.so http://www.fitflops.org http://www.kobebryantshoes.name http://www.oakley-sunglasses.net.co http://www.kevindurantshoes.name http://www.pradauk.co.uk http://www.michaelkorsukpurse.co.uk http://www.gucci-outlet.org http://burberry.bidinc.org http://www.oakleysunglassescheap.name http://www.oakleysunglasses.us.com http://michaelkors.officialstore.com.co http://www.cheapsoccershoes.in.net http://www.coachoutlet-storeonline.in.net http://www.todsshoes.us http://www.jordan8.net http://www.christianlouboutinoutlet.org http://www.raybanglasses.me.uk http://www.abercrombieoutlet.us.com http://www.montblanc-pens.name http://www.christianlouboutin.name http://www.oakleysunglasses-wholesale.name http://www.raybansunglassesoutlet.name http://www.christianlouboutin-shoes.info http://www.raybansunglass.net.co http://www.ray-banoutlet.name http://www.michaelkors--outlet.in.net http://www.truereligion.eu.com http://www.coach-factoryoutlet.com.co http://www.outlet-celine.com http://www.christianlouboutinoutlet.com.co http://www.oakleysunglasses-outlet.name http://www.fitflop-shoes.us http://www.soccer-jerseys.us.com http://www.michaelkors.com.so http://www.todsoutlet.name http://www.cheap--nfljerseys.us.com http://www.abercrombie-fitch.cc http://www.tory-burch-outlet.name http://www.redchristianlouboutin.com http://www.hermes-birkin.us http://www.michaelkors-mkoutlet.in.net http://timberland.officialfree.net http://www.chanel-handbags.net.co http://www.christianlouboutinsale.name http://www.jordan11s.name http://www.pandorajewelry.name http://burberryoutlet.newestsite.net http://www.louisvuitton.us.com http://www.montblanc.com.co http://www.cheap-jordans.us.com http://www.toms--shoes.com http://beatsbydrdre.outletoff.net http://www.cheapjerseys-wholesale.us.com http://www.christianlouboutinsale.biz http://www.michael-korsoutletonline.eu.com http://www.abercrombiestore.org http://www.rayban-sunglasses.eu.com http://www.louis-vuittonhandbags.name http://www.oakley-sunglasses.com.co http://timberlandboots.dealsinc.net http://www.nike-airmax.me.uk http://www.jordan11.name http://www.saclongchamp--pascher.fr http://www.michaelkors-outlet.com.co http://www.gucci-outlet.name http://michaelkors.aphidsymposium.org http://www.cheaprolexwatches.name http://www.chanelbags.com.co http://www.toms-shoes.cc http://www.insanityworkout.com.co http://www.louisvuittonoutlet.net.co http://www.coachfactoryoutlet.com.so http://www.jordanretro.name http://coachoutlet.officialinc.net http://www.toms-outlet.com.co http://www.poloralph-lauren.net.co http://toryburchoutlet.stores.net.co http://www.michaelkorsbag.org.uk http://www.coachoutlet-factory.com.co http://www.dior-handbags.us http://chanelhandbags.newstore.com.co http://www.abercrombiekids.name http://www.coachfactoryoutletonline.eu.com http://www.jordan11concord.org http://www.abercrombie-fitch.com.co http://www.michaelkorsoutletclearance.in.net http://www.jordanconcords.net http://www.gucci-outlet.net.co http://www.lebronjames-shoes.net http://www.adidaswings.name http://www.celine-outlet.us http://www.hollisterclothing.info http://www.ghdhairstraighteners.com.co http://www.lebronjames-shoes.name http://www.oakleysunglasses-sale.in.net http://www.longchamphandbags.com.co http://truereligion.onlineinc.net.co http://www.hollisteroutlet.name http://www.katespade-handbags.eu.com http://www.ray-ban-sunglasses.org.uk http://www.jordan6.net -- [[2015711yuanyuan]] &new{2015-07-10 (金) 22:07:49};
#comment_nospam
- 1 -- [[1]] &new{2013-10-25 (金) 15:33:57};
- 1 -- [[1]] &new{2013-10-21 (月) 11:57:38};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:04};
- 1 -- [[1]] &new{2012-07-13 (金) 18:12:53};
- 1 -- [[1]] &new{2012-06-29 (金) 17:06:41};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:02};
- 1 -- [[1]] &new{2012-03-12 (月) 20:58:30};
#vote(参考になった[3],ふつう[0],参考にならなかった[0])
~
~
~
*DBにMS-Access2003を使用した場合 [#fca0772c]
【ポイント】
プログラムの最初の方に記述されているDB接続名を"MySqlServerDB"から→"MyAccessDB"
に変更するだけで使用DBをSQL ServerからMS-Accessに変更できる。
(Factoryパターンを用いて汎用的なコードで記述している為、接続DBを変更するだけで
どのDBにも接続できるコード記述になっているのが特徴)
Dim setting As ConnectionStringSettings = _
ConfigurationManager.ConnectionStrings("MyAccessDB")
【稼働画面】
#ref(AccessScheduleDesign01.JPG);
#ref(AccessSchedule01.JPG);
#ref(CalCellDisp01.JPG);
【web.configのデータ接続文字列の設定】
MS-AccessDBへの接続名として"MyAccessDB”がweb.configの最初の方の<appSettings>
と<system.web>の間に<connectionStrings>として以下の通り記述されている事を前提とする。
(参考)[[AccessDBの接続文字列の登録法]]
<connectionStrings>
<add name="MyAccessDb" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\AccessDB.mdb"
providerName="System.Data.OleDb" />
</connectionStrings>
【acCalCellDisp.aspx】
<%@ Page Language="VB" ContentType="text/html" %>
<%@ 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">
' それぞれの日付セルをレンダリングするタイミングで実行
Sub cal_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs)
Dim setting As ConnectionStringSettings = _
ConfigurationManager.ConnectionStrings("MyAccessDB")
Dim factory As DbProviderFactory = _
DbProviderFactories.GetFactory(setting.ProviderName)
Using objDb As DbConnection = factory.CreateConnection()
objDb.ConnectionString = setting.ConnectionString
' 出力する日付セルに対応するスケジュール情報を抽出
Dim objCom As DbCommand = factory.CreateCommand()
objCom.CommandText = "SELECT [ID],[title],[sdate],[stime],[etime] FROM [schedule01] WHERE [sdate]=@sdate ORDER BY [stime] ASC"
objCom.Connection = objDb
Dim objPrm As DbParameter = factory.CreateParameter()
objPrm.ParameterName = "@sdate"
objPrm.Value = e.Day.Date.ToString("yyyy/MM/dd")
objCom.Parameters.Add(objPrm)
objDb.Open()
Dim objRd As DbDataReader = objCom.ExecuteReader()
' 取得したスケジュール情報を基に
' LiteralControl(固定文字列)を生成し、
' 日付セル(e.Call)配下のコントロールとして追加
Do While objRd.Read()
e.Cell.Controls.Add(New LiteralControl("<br />" & String.Format("{0}〜{1}:{2}", objRd.GetString(3), objRd.GetString(4), objRd.G etString(1))))
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>
<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">
<SelectedDayStyle BackColor="#CC5533" />
</asp:Calendar>
<br />
</div>
</form>
</body>
</html>
【参考にしたページ】
1.「Calendarコントロールのセルに任意のデータを埋め込むには?」05/03/18
http://www.atmarkit.co.jp/fdotnet/dotnettips/277aspcalceldata/aspcalceldata.html
2.「データソース・コントロールでいってみよう(前編)」 06/07/29
http://www.atmarkit.co.jp/fdotnet/vs2005db/vs2005db_06/vs2005db_06_03.html
3.「ASP.NET アクセスデータにアクセスする(コーディング)」
http://3939deb.seesaa.net/article/107785168.html
- 1 -- [[1]] &new{2012-03-12 (月) 20:58:51};
- 1 -- [[1]] &new{2012-03-12 (月) 20:58:54};
- 1 -- [[-1']] &new{2012-03-12 (月) 20:58:55};
-- 1' -- [[1]] &new{2012-03-12 (月) 20:58:56};
- 1 -- [[1]] &new{2012-03-12 (月) 20:58:57};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:23};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:26};
- 1 -- [[-1']] &new{2012-04-29 (日) 02:14:27};
-- 1' -- [[1]] &new{2012-04-29 (日) 02:14:28};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:29};
- 1 -- [[1]] &new{2012-06-29 (金) 17:07:07};
- 1 -- [[1]] &new{2012-06-29 (金) 17:07:10};
- 1 -- [[-1']] &new{2012-06-29 (金) 17:07:11};
-- 1' -- [[1]] &new{2012-06-29 (金) 17:07:12};
- 1 -- [[1]] &new{2012-06-29 (金) 17:07:14};
- 1 -- [[1]] &new{2012-07-13 (金) 18:13:15};
- 1 -- [[1]] &new{2012-07-13 (金) 18:13:18};
- 1 -- [[-1']] &new{2012-07-13 (金) 18:13:19};
-- 1' -- [[1]] &new{2012-07-13 (金) 18:13:21};
- 1 -- [[1]] &new{2012-07-13 (金) 18:13:22};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:26};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:29};
- 1 -- [[-1']] &new{2012-08-26 (日) 21:06:30};
-- 1' -- [[1]] &new{2012-08-26 (日) 21:06:31};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:33};
- 1 -- [[1]] &new{2013-10-21 (月) 11:58:29};
- 1 -- [[1]] &new{2013-10-21 (月) 11:58:39};
- 1 -- [[-1']] &new{2013-10-21 (月) 11:58:44};
- 1 -- [[1]] &new{2013-10-25 (金) 15:35:03};
- 1 -- [[1]] &new{2013-10-25 (金) 15:35:08};
- 1 -- [[-1']] &new{2013-10-25 (金) 15:35:10};
-- 1' -- [[1]] &new{2013-10-25 (金) 15:35:12};
- 1 -- [[1]] &new{2013-10-25 (金) 15:35:14};
- 1 -- [[1]] &new{2014-05-14 (水) 12:20:44};
- 1 -- [[1]] &new{2014-05-14 (水) 12:20:45};
- 1 -- [[-1']] &new{2014-05-14 (水) 12:20:47};
-- 1' -- [[1]] &new{2014-05-14 (水) 12:20:48};
- 1 -- [[1]] &new{2014-05-14 (水) 12:20:48};
- 1 -- [[1]] &new{2015-03-15 (日) 14:21:36};
- 1 -- [[1]] &new{2015-03-15 (日) 14:21:38};
- 1 -- [[-1']] &new{2015-03-15 (日) 14:21:39};
-- 1' -- [[1]] &new{2015-03-15 (日) 14:21:41};
- 1 -- [[1]] &new{2015-03-15 (日) 14:21:44};
- 1 -- [[1]] &new{2015-05-17 (日) 16:01:48};
- 1 -- [[1]] &new{2015-05-17 (日) 16:01:53};
- 1 -- [[-1']] &new{2015-05-17 (日) 16:01:54};
-- 1' -- [[1]] &new{2015-05-17 (日) 16:01:55};
- 1 -- [[1]] &new{2015-05-17 (日) 16:01:56};
#comment_nospam
- 1 -- [[1]] &new{2015-05-17 (日) 16:01:52};
- 1 -- [[1]] &new{2015-03-15 (日) 14:21:37};
- 1 -- [[1]] &new{2014-05-14 (水) 12:20:45};
- 1 -- [[1]] &new{2013-10-25 (金) 15:35:05};
- 1 -- [[1]] &new{2013-10-21 (月) 11:58:32};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:27};
- 1 -- [[1]] &new{2012-07-13 (金) 18:13:16};
- 1 -- [[1]] &new{2012-06-29 (金) 17:07:08};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:24};
- 1 -- [[1]] &new{2012-03-12 (月) 20:58:52};
#vote(参考になった[1],ふつう[0],参考にならなかった[0])
~
~
~
*(参考)SqlDataSourceコントロールを利用して実現した場合 [#tfaf915e]
カレンダ コントロールとSqlDataSourceコントロールを利用して、スケジュール情報
をカレンダに表示した事例である。コードの記述が少なくて実現出来るのが特徴。 10/08/10
【sqlCalCellDisp_sqlDS.aspx】
<%@ Page Language="VB" ContentType="text/html" %>
<%@ Import Namespace="System.Data" %>
<%@ 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">
' それぞれの日付セルをレンダリングするタイミングで実行
Sub cal_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs)
sds.SelectParameters.Clear()
sds.SelectParameters.Add("sdate", e.Day.Date.ToString("yyyy/MM/dd"))
Dim objRd As IDataReader = sds.Select(DataSourceSelectArguments.Empty)
' 取得したスケジュール情報を基に
' LiteralControl(固定文字列)を生成し、
' 日付セル(e.Call)配下のコントロールとして追加
Do While objRd.Read()
e.Cell.Controls.Add(New LiteralControl("<br />" & String.Format("{0}〜{1}:{2}", objRd.GetString(3), objRd.GetStr ing(4), objRd.GetString(1))))
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>
<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">
<SelectedDayStyle BackColor="#CC5533" />
</asp:Calendar>
<asp:SqlDataSource ID="sds" runat="server"
ConnectionString="<%$ ConnectionStrings:MySqlServerDB %>" DataSourceMode="DataReader"
ProviderName="<%$ ConnectionStrings:MySqlServerDB.ProviderName %>"
SelectCommand="SELECT [ID], [title], [sdate], [stime], [etime] FROM [schedule01] WHERE ([sdate] = @sdate) ORDER B Y [stime] ASC">
</asp:SqlDataSource>
<br />
<br />
</div>
</form>
</body>
</html>
- 1 -- [[1]] &new{2012-03-12 (月) 20:59:14};
- 1 -- [[1]] &new{2012-03-12 (月) 20:59:17};
- 1 -- [[-1']] &new{2012-03-12 (月) 20:59:18};
-- 1' -- [[1]] &new{2012-03-12 (月) 20:59:19};
- 1 -- [[1]] &new{2012-03-12 (月) 20:59:20};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:45};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:48};
- 1 -- [[-1']] &new{2012-04-29 (日) 02:14:49};
-- 1' -- [[1]] &new{2012-04-29 (日) 02:14:50};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:51};
- 1 -- [[1]] &new{2012-06-29 (金) 17:07:33};
- 1 -- [[1]] &new{2012-06-29 (金) 17:07:36};
- 1 -- [[-1']] &new{2012-06-29 (金) 17:07:37};
-- 1' -- [[1]] &new{2012-06-29 (金) 17:07:38};
- 1 -- [[1]] &new{2012-06-29 (金) 17:07:39};
- 1 -- [[1]] &new{2012-07-13 (金) 18:13:41};
- 1 -- [[1]] &new{2012-07-13 (金) 18:13:44};
- 1 -- [[-1']] &new{2012-07-13 (金) 18:13:45};
-- 1' -- [[1]] &new{2012-07-13 (金) 18:13:46};
- 1 -- [[1]] &new{2012-07-13 (金) 18:13:47};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:50};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:52};
- 1 -- [[-1']] &new{2012-08-26 (日) 21:06:53};
-- 1' -- [[1]] &new{2012-08-26 (日) 21:06:54};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:56};
- 1 -- [[1]] &new{2013-10-21 (月) 12:00:05};
- 1 -- [[1]] &new{2013-10-21 (月) 12:00:10};
- 1 -- [[-1']] &new{2013-10-21 (月) 12:00:13};
-- 1' -- [[1]] &new{2013-10-21 (月) 12:00:18};
- 1 -- [[1]] &new{2013-10-21 (月) 12:00:35};
- 1 -- [[1]] &new{2013-10-25 (金) 15:36:40};
- 1 -- [[1]] &new{2013-10-25 (金) 15:36:52};
- 1 -- [[-1']] &new{2013-10-25 (金) 15:36:59};
-- 1' -- [[1]] &new{2013-10-25 (金) 15:37:03};
- 1 -- [[1]] &new{2013-10-25 (金) 15:37:06};
- 1 -- [[1]] &new{2014-05-14 (水) 12:24:46};
- 1 -- [[1]] &new{2014-05-14 (水) 12:24:47};
- 1 -- [[-1']] &new{2014-05-14 (水) 12:24:48};
-- 1' -- [[1]] &new{2014-05-14 (水) 12:24:49};
- 1 -- [[1]] &new{2014-05-14 (水) 12:24:50};
-- 1' -- [[1]] &new{2015-05-17 (日) 16:04:54};
- 1 -- [[1]] &new{2015-05-17 (日) 16:04:55};
#comment_nospam
- 1 -- [[1]] &new{2014-05-14 (水) 12:24:47};
- 1 -- [[1]] &new{2013-10-25 (金) 15:36:47};
- 1 -- [[1]] &new{2013-10-21 (月) 12:00:08};
- 1 -- [[1]] &new{2012-08-26 (日) 21:06:51};
- 1 -- [[1]] &new{2012-07-13 (金) 18:13:43};
- 1 -- [[1]] &new{2012-06-29 (金) 17:07:34};
- 1 -- [[1]] &new{2012-04-29 (日) 02:14:47};
- 1 -- [[1]] &new{2012-03-12 (月) 20:59:15};
#vote(参考になった[0],ふつう[0],参考にならなかった[0])