User564995064 posted
I have an EditItemTemplate with form data in it. The submit date is in a label. The code below works except for the submit date. Any idea what I am doing wrong?
try
{
Record formData = new Record();
txt = fv.FindControl(String.Format("txtLastname{0}", formMode)) as TextBox;
formData.LastName = txt.Text;
txt = fv.FindControl(String.Format("txtFirstname{0}", formMode)) as TextBox;
formData.FirstName = txt.Text;
txt = fv.FindControl(String.Format("txtMiddle{0}", formMode)) as TextBox;
formData.MI = txt.Text;
DateTimePicker dtp = fv.FindControl(String.Format("dtpDob{0}", formMode)) as DateTimePicker;
formData.BirthDate = dtp.Value;
Label lblDateSubmit = fv.FindControl(String.Format("lblSubmitDate{0}", formMode)) as Label;
formData.DateSubmission = DateTime.Parse(lblDateSubmit.Text.ToString());
return formData;
}
html:
<td>
<asp:Label ID="lblSubmitDate" runat="server" Text='<%# Eval("date_submit")%>'></asp:Label>
</td>
Originally I had the html as:
<td>
<%# Eval("date_submit")%>
</td>
but I thought I may need to add a label so I could reference it in the c# code. As I step through the code, the submit date is blank. It will not extract the record.
Thanks for any assistance you can give!