我正在尝试获取标签的文本并将其分配给字符串,但它似乎无法找到控件。请注意,这是在我的页面后面的代码中完成的(后面代码的自动生成功能不正常,所以我必须手动找到它)。
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);
}