<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://isom.uoregon.edu/community/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Duck Bytes : SQL Server 2005</title><link>http://isom.uoregon.edu/community/blogs/castner/archive/tags/SQL+Server+2005/default.aspx</link><description>Tags: SQL Server 2005</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Using the ASP.NET calendar control to display event information</title><link>http://isom.uoregon.edu/community/blogs/castner/archive/2007/03/09/Using-the-ASP.NET-2-calendar-control-to-display-event-information.aspx</link><pubDate>Fri, 09 Mar 2007 11:51:00 GMT</pubDate><guid isPermaLink="false">4ac6e2ff-a44c-42df-b503-9719f53eb121:777</guid><dc:creator>gcastner</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://isom.uoregon.edu/community/blogs/castner/rsscomments.aspx?PostID=777</wfw:commentRss><comments>http://isom.uoregon.edu/community/blogs/castner/archive/2007/03/09/Using-the-ASP.NET-2-calendar-control-to-display-event-information.aspx#comments</comments><description>&lt;p&gt;The calendar control is useful for displaying event dates that users can then click on for more information. Here are the steps for setting up the calendar control to display event information from database.&lt;/p&gt;
&lt;p&gt;1. Place a calendar control on the required page (for example, &lt;em&gt;default.aspx)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;2. Create a second page called &lt;em&gt;calendar.aspx&lt;/em&gt; for displaying the event information.&lt;/p&gt;
&lt;p&gt;3. In your codebehind file for the page with the calendar control&amp;nbsp;(&lt;em&gt;default.aspx.vb&lt;/em&gt; in my example), create the SelectionChanged Sub for your calendar control (&lt;em&gt;calendar1&lt;/em&gt; in my example) and enter&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Display calendar details when date selected&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim eventDateSelected As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; eventDateSelected = Format(Calendar1.SelectedDate.Date, &amp;quot;MM/dd/yyyy&amp;quot;).ToString&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Redirect(&amp;quot;calendar.aspx?eventDate=&amp;quot; &amp;amp; eventDateSelected)&lt;br /&gt;&amp;nbsp; End Sub&lt;/p&gt;
&lt;p&gt;The code above retrieves the date clicked on by the user &lt;em&gt;(Calendar1.SelectedDate.Date&lt;/em&gt;), formats the date, and redirects the user to calendar.aspx with the date selected as a querystring. You will need to format the date to match the format of the date in your database &lt;em&gt;events&lt;/em&gt; table.&lt;/p&gt;
&lt;p&gt;4. In calendar.aspx, use a data control such as a detailsview or formview to display the information.&lt;/p&gt;
&lt;p&gt;5. When setting up your formview or detailsview data source (assuming that you are using Visual Studio or Visual Web Developer), click the &lt;strong&gt;Where&lt;/strong&gt; button to create the querystring criteria. The column should be your date column, the &lt;strong&gt;Source&lt;/strong&gt; should be &lt;strong&gt;QueryString&lt;/strong&gt;, and the &lt;strong&gt;QueryString&lt;/strong&gt; Field should be &lt;em&gt;eventDate &lt;/em&gt;(if you are using the code above).&lt;/p&gt;
&lt;p&gt;One thing I should stress is that the date format from the database needs to match the date format of the query string. I use a SQL Server 2005 database to store event data. In the view I created to display event information, I use the following conversion to extract the date from the &lt;em&gt;eventDate&lt;/em&gt; column&amp;nbsp;and match it with the query string:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;CONVERT (nvarchar(30), eventDate, 101)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;101 is one of the predefined date formats.&lt;/p&gt;&lt;img src="http://isom.uoregon.edu/community/aggbug.aspx?PostID=777" width="1" height="1"&gt;</description><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/Calendar+control/default.aspx">Calendar control</category></item><item><title>Converting newline character to &lt;br /&gt;</title><link>http://isom.uoregon.edu/community/blogs/castner/archive/2006/12/05/Converting-newline-character-to-_3C00_br-_2F003E00_.aspx</link><pubDate>Wed, 06 Dec 2006 03:32:00 GMT</pubDate><guid isPermaLink="false">4ac6e2ff-a44c-42df-b503-9719f53eb121:349</guid><dc:creator>gcastner</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://isom.uoregon.edu/community/blogs/castner/rsscomments.aspx?PostID=349</wfw:commentRss><comments>http://isom.uoregon.edu/community/blogs/castner/archive/2006/12/05/Converting-newline-character-to-_3C00_br-_2F003E00_.aspx#comments</comments><description>This post has moved to &lt;a href="http://www.castnerit.com/blog/?p=48" title="http://www.castnerit.com/blog/?p=48"&gt;http://www.castnerit.com/blog/?p=48&lt;/a&gt;.&lt;br /&gt;&lt;img src="http://isom.uoregon.edu/community/aggbug.aspx?PostID=349" width="1" height="1"&gt;</description><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/newline+character/default.aspx">newline character</category></item><item><title>Configuring SQL Server 2005 for database-driven web pages</title><link>http://isom.uoregon.edu/community/blogs/castner/archive/2006/10/25/Configuring-SQL-Server-2005-for-database_2D00_driven-web-pages.aspx</link><pubDate>Wed, 25 Oct 2006 18:07:00 GMT</pubDate><guid isPermaLink="false">4ac6e2ff-a44c-42df-b503-9719f53eb121:22</guid><dc:creator>gcastner</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://isom.uoregon.edu/community/blogs/castner/rsscomments.aspx?PostID=22</wfw:commentRss><comments>http://isom.uoregon.edu/community/blogs/castner/archive/2006/10/25/Configuring-SQL-Server-2005-for-database_2D00_driven-web-pages.aspx#comments</comments><description>&lt;p&gt;This post has moved to &lt;a href="http://castnerit.com/blog/?p=22"&gt;http://castnerit.com/blog/?p=22&lt;/a&gt;&lt;/p&gt;&lt;img src="http://isom.uoregon.edu/community/aggbug.aspx?PostID=22" width="1" height="1"&gt;</description><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item></channel></rss>