Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

For Designer File

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="calender.aspx.cs" Inherits="calender" %> <!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></title> <link media="screen" rel="stylesheet" href="includes/colorbox.css" /> <script src="includes/jquery.min.js"></script> <script src="includes/jquery.colorbox.js"></script> <script> $(document).ready(function () { //Examples of how to assign the ColorBox event to elements $("a[rel='example1']").colorbox(); $("a[rel='example2']").colorbox({ transition: "fade" }); $("a[rel='example3']").colorbox({ transition: "none", width: "75%", height: "75%" }); $("a[rel='example4']").colorbox({ slideshow: true }); $(".example5").colorbox({ width: "50%", height: "50%", iframe: true }); $(".example6").colorbox({ iframe: true, innerWidth: 645, innerHeight: 600 }); $(".example7").colorbox({ width: "80%", height: "80%", iframe: true }); $(".example8").colorbox({ width: "50%", inline: true, href: "#inline_example1" }); $(".example9").colorbox({ onOpen: function () { alert('onOpen: colorbox is about to open'); }, onLoad: function () { alert('onLoad: colorbox has started to load the targeted content'); }, onComplete: function () { alert('onComplete: colorbox has displayed the loaded content'); }, onCleanup: function () { alert('onCleanup: colorbox has begun the close process'); }, onClosed: function () { alert('onClosed: colorbox has completely closed'); } }); //Example of preserving a JavaScript event for inline calls. $("#click").click(function () { $('#click').css({ "background-color": "#f00", "color": "#fff", "cursor": "inherit" }).text("Open this window again and this message will still be here."); return false; }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="5%" height="44">

<img src="images/img_arroworange.gif" alt="" width="24" height="24" /></td> <td width="95%" class="titlefont"> Upcoming Events</td> </tr> </table> </td> </tr> <tr> <td align="center"> <table> <tr> <td class="bodytext" valign="top"> Month:</td> <td valign="top"> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlMonth" ErrorMessage="Month" SetFocusOnError="True" ValidationGroup="vgCon">*</asp:RequiredFieldValidator> </td> <td valign="top"> <asp:DropDownList ID="ddlMonth" runat="server" CssClass="enqinp" Width="80" Height="25"> <asp:ListItem Value="0">--select--</asp:ListItem> <asp:ListItem Value="1">JAN</asp:ListItem> <asp:ListItem Value="2">FEB</asp:ListItem> <asp:ListItem Value="3">MAR</asp:ListItem> <asp:ListItem Value="4">APR</asp:ListItem> <asp:ListItem Value="5">MAY</asp:ListItem> <asp:ListItem Value="6">JUN</asp:ListItem> <asp:ListItem Value="7">JUL</asp:ListItem> <asp:ListItem Value="8">AUG</asp:ListItem> <asp:ListItem Value="9">SEP</asp:ListItem> <asp:ListItem Value="10">OCT</asp:ListItem> <asp:ListItem Value="11">NOV</asp:ListItem> <asp:ListItem Value="12">DEC</asp:ListItem> </asp:DropDownList></td> <td> &nbsp;</td> <td class="bodytext" valign="top"> Year:</td> <td valign="top"> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlYear" ErrorMessage="Year" SetFocusOnError="True" ValidationGroup="vgCon">*</asp:RequiredFieldValidator> </td> <td valign="top"> <asp:DropDownList ID="ddlYear" runat="server" CssClass="enqinp" Width="80" Height="25"> <asp:ListItem Value="0" Selected="True">--select-</asp:ListItem> </asp:DropDownList></td> <td> &nbsp;</td> <td valign="top"> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/btn_go.gif"

OnClick="ImageButton1_Click" ValidationGroup="vgCon" /></td> <td> <asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="You must enter the following values:" ShowMessageBox="True" ShowSummary="False" ValidationGroup="vgCon" /> </td> </tr> </table> </td> </tr> <tr> <td valign="top"> <asp:Calendar ID="Calendar2" runat="server" Height="410px" OnDayRender="Calendar2_DayRender" BorderColor="#adacac" NextPrevStyle-CssClass="calendarlink" CssClass="bodytext" NextPrevStyle-ForeColor="#ffffff" Width="650px" PrevMonthText="Previous Month" NextMonthText="Next Month" CellPadding="5" ShowGridLines="True"> <SelectedDayStyle BackColor="#0060b4" CssClass="bodytext" ForeColor="#ffffff" /> <NextPrevStyle Height="25px" Width="650px" CssClass="calendarlink" /> <TitleStyle BackColor="#0060b4" CssClass="calendarlink" /> </asp:Calendar> </td> </tr> </table> </div> </form> </body> </html>

For Code File

using using using using using using

System; System.Collections.Generic; System.Web; System.Web.UI; System.Web.UI.WebControls; System.Data;

public partial class calender : System.Web.UI.Page { GeneralFunction GFobj = new GeneralFunction(); protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { // ModalPopupExtender1.Hide(); Calendar2.SelectedDate = DateTime.Now.Date; Calendar2.VisibleDate = DateTime.Now.Date; int year = int.Parse(DateTime.Now.Year.ToString()); ddlYear.Items.Add((year - 1).ToString()); ddlYear.Items.Add((year).ToString()); ddlYear.Items.Add((year + 1).ToString()); ddlYear.Items.Add((year + 2).ToString()); ddlYear.Items.Add((year + 3).ToString()); ddlYear.Items.Add((year + 4).ToString()); ddlYear.Items.Add((year + 5).ToString()); } } protected void Calendar2_DayRender(object sender, DayRenderEventArgs e) { string str = "select * from Enquiry"; DataTable dt = new DataTable(); dt = Dataacess.GetDataTable(str, CommandType.Text, null); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (e.Day.Date.CompareTo(Convert.ToDateTime(dt.Rows[i]["enq_date"].ToString())) == 0) { string toop; if (e.Day.Date.CompareTo(DateTime.Now.Date) == 0) toop = "<a class='example5' href='Worst.aspx?id=" + dt.Rows[i]["id"].ToString() + "' title='" + dt.Rows[i]["ename"].ToString().Replace("&#39;", "'") + "'><font color='#000000'>" + e.Day.Date.ToString("dd") + "<br>" + dt.Rows[i]["ename"].ToString().Replace("&#39;", "'") + "</font></a>"; else toop = "<a class='example5' href='Worst.aspx?id=" + dt.Rows[i]["id"].ToString() + "' title='" + dt.Rows[i]["ename"].ToString().Replace("&#39;", "'") + "'><font color='#000000'>" + e.Day.Date.ToString("dd") + "<br>" + dt.Rows[i]["ename"].ToString().Replace("&#39;", "'") + "</font></a>"; e.Cell.Text += toop + "<br><br>";

} } } } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string str = ddlMonth.SelectedItem.Value.ToString() + "/1/" + ddlYear.SelectedItem.ToString(); DateTime dt = Convert.ToDateTime(str); Calendar2.SelectedDate = dt; Calendar2.VisibleDate = dt; } }

You might also like