suicidaltendencies
Programmer
How do I update the value of the calendar that is in my datagrid? It is bombing out when I try to update the calendar.
Thanks,
Harold
<asp:templatecolumn headerstyle-wrap="false" HeaderText="Date" itemstyle-verticalalign="top">
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, "AppointmentDate", "{0:MM/dd/yyyy}" %>
</itemtemplate>
<edititemtemplate>
<asp:calendar id="calDate" runat="server" selecteddate = '<%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "AppointmentDate") %>' visibledate='<%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "AppointmentDate") %>'/>
</edititemtemplate>
</asp:templatecolumn>
// Variables
TextBox ctlNotes, ctlTimes;
Calendar ctlCalDate;
DropDownList ctlServiceName;
string strAppointmentID = dgEditAppointments.DataKeys[e.Item.ItemIndex].ToString();
ctlServiceName= (DropDownList)e.Item.FindControl("ddlService"
ctlCalDate = (Calendar)e.Item.FindControl("calDate"
ctlNotes = (TextBox)e.Item.FindControl("txtNotes"
ctlTimes = (TextBox)e.Item.FindControl("txtTimes"
// get the connection
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
// update string
string strMySQL = "Update Appointments Set AppointmentDate = '" + ctlCalDate + "', Notes = '" + ctlNotes.Text + "' WHERE AppointmentID = '" + strAppointmentID + "'";
Thanks,
Harold
<asp:templatecolumn headerstyle-wrap="false" HeaderText="Date" itemstyle-verticalalign="top">
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, "AppointmentDate", "{0:MM/dd/yyyy}" %>
</itemtemplate>
<edititemtemplate>
<asp:calendar id="calDate" runat="server" selecteddate = '<%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "AppointmentDate") %>' visibledate='<%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "AppointmentDate") %>'/>
</edititemtemplate>
</asp:templatecolumn>
// Variables
TextBox ctlNotes, ctlTimes;
Calendar ctlCalDate;
DropDownList ctlServiceName;
string strAppointmentID = dgEditAppointments.DataKeys[e.Item.ItemIndex].ToString();
ctlServiceName= (DropDownList)e.Item.FindControl("ddlService"
ctlCalDate = (Calendar)e.Item.FindControl("calDate"
ctlNotes = (TextBox)e.Item.FindControl("txtNotes"
ctlTimes = (TextBox)e.Item.FindControl("txtTimes"
// get the connection
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
// update string
string strMySQL = "Update Appointments Set AppointmentDate = '" + ctlCalDate + "', Notes = '" + ctlNotes.Text + "' WHERE AppointmentID = '" + strAppointmentID + "'";