I am trying to obtain the text of a label and assign it to a string, however it does not seem to be able to find the control. Please note that this is done in the code behind for my page (the auto generation for the code behind is not functioning properly so I am having to find it manually).
public void ObtainDate()
{
var controlList = ProductPromotion.Controls;
foreach (Control control in controlList)
{
if (control is TableRow)
{
var newControl = control.FindControl("StartDate");
if (newControl != null)
{
Label startControl = newControl as Label;
startDate = startControl.Text;
}
}
}
Fabric.SettingsProvider.WriteSetting<string>(startDate, startSetting);
}