|
|
Am explaining how to make popup Calender with calender control in ASP.NET
Design:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/Vetcare.Master" AutoEventWireup="true" Codebehind="Addholiday.aspx.cs" Inherits="VetCareWeb.Addholiday" Title="Add Holidays" StylesheetTheme="Themes" %>
width="90%"> ShowMessageBox="true" ShowSummary="false" /> InitialValue="none" Display="none" ValidationGroup="Holiday" ErrorMessage="Select branch" /> Display="none" ControlToValidate="txtDay" ErrorMessage="Enter holiday date" /> Display="none" ControlToValidate="txtEvent" ErrorMessage="Enter event" /> |
| * indicates Mandatory field
| BorderWidth="0px" CellPadding="3" EnableTheming="true" Width="100%" SkinID="gridviewSkin" OnRowDataBound="gvHolidayList_RowDataBound" DataKeyNames="Id"> SL# HeaderStyle-HorizontalAlign="center" ItemStyle-HorizontalAlign="center" /> ItemStyle-HorizontalAlign="center" /> ItemStyle-HorizontalAlign="center" /> | | * Branch | : | | * Date | : |  | * Event | : | | | |
|
.CS page: using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using SourceEdge.BCL; using Tetragon.Spruce.Model; using System.Collections.Generic;
namespace VetCareWeb { public partial class Addholiday : System.Web.UI.Page { public int i = 0; string Script = string.Empty;
protected void Page_Load(object sender, EventArgs e) {
}
private void fngetBranches() { ddlBranch.Items.Clear(); ddlBranch.Items.Add(new ListItem("--- Select Branch ---", "none"));
List lstBranch = Database.SelectFrom(UnitEntity.Table) .Where(UnitEntity.Table.UnitType == "Branch") .OrderBy(UnitEntity.Table.Name) .LoadList(); if (lstBranch != null) { if (lstBranch.Count > 0) { foreach (UnitEntity objBranch in lstBranch) { ddlBranch.Items.Add(new ListItem(objBranch.Name, objBranch.Id)); } } } }
protected void gvHolidayList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { i += 1; Label lblSlno = (Label)e.Row.FindControl("lblSlno"); lblSlno.Text = i.ToString(); } }
protected void btnCalender_Click(object sender, ImageClickEventArgs e) { } } } Child page: Design: <%@ Page Language="C#" MasterPageFile="~/MasterPages/Vetcare.Master" AutoEventWireup="true" Codebehind="Addholiday.aspx.cs" Inherits="VetCareWeb.Addholiday" Title="Add Holidays" StylesheetTheme="Themes" %>
width="90%"> ShowMessageBox="true" ShowSummary="false" /> InitialValue="none" Display="none" ValidationGroup="Holiday" ErrorMessage="Select branch" /> Display="none" ControlToValidate="txtDay" ErrorMessage="Enter holiday date" /> Display="none" ControlToValidate="txtEvent" ErrorMessage="Enter event" /> |
| * indicates Mandatory field
| BorderWidth="0px" CellPadding="3" EnableTheming="true" Width="100%" SkinID="gridviewSkin" OnRowDataBound="gvHolidayList_RowDataBound" DataKeyNames="Id"> SL# HeaderStyle-HorizontalAlign="center" ItemStyle-HorizontalAlign="center" /> ItemStyle-HorizontalAlign="center" /> ItemStyle-HorizontalAlign="center" /> | | * Branch | : | | * Date | : |  | * Event | : | | | |
|
.CS : using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using SourceEdge.BCL; using Tetragon.Spruce.Model; using System.Collections.Generic;
namespace VetCareWeb { public partial class Calender : System.Web.UI.Page { protected System.Web.UI.HtmlControls.HtmlInputHidden control; protected System.Web.UI.WebControls.Calendar calDate;
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { fngetYear(); string Month = DateTime.Now.Month.ToString(); string Year = DateTime.Now.Year.ToString(); ddlYear.SelectedIndex = ddlYear.Items.IndexOf(ddlYear.Items.FindByValue(Year)); ddlMonth.SelectedIndex = ddlMonth.Items.IndexOf(ddlMonth.Items.FindByValue(Month)); control.Value = Request.QueryString["textbox"].ToString(); } }
private void fngetYear() { int Dyear = DateTime.Now.AddYears(1).Year; ddlYear.Items.Clear(); ddlYear.Items.Add(new ListItem("--Select Year--", "none")); for (int CntYear = 2007; CntYear <= Dyear; CntYear++) { ddlYear.Items.Add(new ListItem(Convert.ToString(CntYear), Convert.ToString(CntYear))); } }
protected void Change_Date(object sender, System.EventArgs e) { string strScript = "
|
Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend
|