I have a calendar control on my page and when the user clicks on a date I want to capture that date to use to populate grids ect on the page simple no?.... Problem is the Date that was clicked on is not the value until the page finishes loading.... Here is the code of a very simple example that does what I am talking about.
Code behind:
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;
public partial class Junk : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lblLoad.Text = Cal.SelectedDate.ToString();
}
protected void Page_LoadComplete(object sender, EventArgs e)
{
lblAfterLoad.Text = Cal.SelectedDate.ToString();
}
}
Asp Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Junk.aspx.cs" Inherits="Junk" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Calendar ID="Cal" runat="server"></asp:Calendar><br /><br />
<asp:Label runat="server" ID="lblLoad"></asp:Label><br />
<asp:Label runat="server" ID="lblAfterLoad"></asp:Label>
</div>
</form>
</body>
</html>
Thanks for any help
Code behind:
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;
public partial class Junk : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lblLoad.Text = Cal.SelectedDate.ToString();
}
protected void Page_LoadComplete(object sender, EventArgs e)
{
lblAfterLoad.Text = Cal.SelectedDate.ToString();
}
}
Asp Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Junk.aspx.cs" Inherits="Junk" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Calendar ID="Cal" runat="server"></asp:Calendar><br /><br />
<asp:Label runat="server" ID="lblLoad"></asp:Label><br />
<asp:Label runat="server" ID="lblAfterLoad"></asp:Label>
</div>
</form>
</body>
</html>
Thanks for any help