我正在尝试捕获GUID值并存储在字符串变量中但获取空值
public string StudentRemediationSignatureCheckGuid { get; set; }
ContextSession给我GUID值,我想将其分配给上面的变量
_assessmentRemidationObject.StudentRemediationSignatureCheckGuid = ContextSession.GUID.ToString();
public string SeniorAssessorGuid = string.Empty; //global variable
protected void checkBoxSeniorAssessorSignature_CheckedChanged(object sender, EventArgs e)
{
CheckBox SelectedCheckBoxObject4 = (CheckBox)sender;
if (SelectedCheckBoxObject4.Checked)
{
TxtBoxSeniorAssessorSignatureDate.Text = System.DateTime.Now.ToString("d/M/yyyy");
_assessmentRemidationObject.SeniorAssessorSignatureCheckGuid = ContextSession.GUID.ToString();
SeniorAssessorGuid = ContextSession.GUID.ToString();
}
else if (!SelectedCheckBoxObject4.Checked)
{
TxtBoxSeniorAssessorSignatureDate.Text = string.Empty;
}
}
答案 0 :(得分:1)
如果您丢失其值,请不要将ContextSession.GUID
的值存储在您网页_assessmentRemidationObject
的成员中。您需要使用全局变量或持久存储(例如数据库)。在阅读之前,请尝试找到重置_assessmentRemidationObject
的位置。