![]() |
Web Development »
ASP.NET »
General
Intermediate
GridView needs more plumbing code to support Calendar controlsBy Viswanath MajetiGridView needs more plumbing code to support Calendar controls |
C# 2.0, Windows, .NET 2.0, ASP.NET, WebForms, VS2005, Dev
|
||||||||
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Download TaskManager.zip - 55.4 KB
GridView needs more plumbing code to support Calendar controls

<code>
protected void Page_Load(object sender, EventArgs e)
{
if (ViewState["StartDate"] != null)
{
((Calendar)grdTaskManager.Rows[grdTaskManager.EditIndex].Cells[5].Controls[1]).SelectedDate = (DateTime)ViewState["StartDate"];
}
if (ViewState["EndDate"] != null)
{
((Calendar)grdTaskManager.Rows[grdTaskManager.EditIndex].Cells[6].Controls[1]).SelectedDate = (DateTime)ViewState["EndDate"];
}
}
</code>
<code>
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
ViewState["StartDate"] = ((Calendar)grdTaskManager.Rows[grdTaskManager.EditIndex].Cells[5].Controls[1]).SelectedDate;
}
</code>
<code>
protected void Calendar2_SelectionChanged(object sender, EventArgs e)
{
ViewState["EndDate"] = ((Calendar)grdTaskManager.Rows[grdTaskManager.EditIndex].Cells[6].Controls[1]).SelectedDate;
}
</code>
<code>
protected void odsTaskManager_Updating(object sender, SqlDataSourceCommandEventArgs e)
{
if (ViewState["StartDate"] != null)
{
e.Command.Parameters["@StartDate"].Value = ((DateTime)ViewState["StartDate"]).ToString();
ViewState.Remove("StartDate");
}
if (ViewState["EndDate"] != null)
{
e.Command.Parameters["@EndDate"].Value = ((DateTime)ViewState["EndDate"]).ToString();
ViewState.Remove("EndDate");
}
if (txtTaskDescription.Text.Length >
| You must Sign In to use this message board. | ||||||||
|
||||||||
|
||||||||
|
||||||||
|
||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 27 Nov 2007 Editor: |
Copyright 2007 by Viswanath Majeti Everything else Copyright © CodeProject, 1999-2009 Web10 | Advertise on the Code Project |