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;
}
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.
Member
33 Points
109 Posts
Extracting Record from Form View
Feb 22, 2017 05:46 PM|rhondadunn|LINK
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?
Originally I had the html as:
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!
Member
20 Points
6 Posts
Re: Extracting Record from Form View
Feb 23, 2017 09:43 AM|Stanly_F|LINK
Hi rhondadunn,
According to your current code and description, I can't reproduce the problem, I'm willing to help you if you can provide more code.
The problem may be the way you finding the "lblSubmitDate" control is invalid.
You can find it through the way "fv.row.FindControl()".
or:
Hope this helps!
Best Regards
Stanly