[英]Assign Guid value to C# variable i.e. string
I am trying to capture GUID value and store in string variable but getting null value 我正在尝试捕获GUID值并存储在字符串变量中,但得到空值
public string StudentRemediationSignatureCheckGuid { get; set; }
ContextSession give me GUID value which I like to assign to variable above define 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;
}
}
Do not store the value of the ContextSession.GUID
in a member of your page _assessmentRemidationObject
if you loose its value. 如果
_assessmentRemidationObject
ContextSession.GUID
的值,请勿将其存储在页面_assessmentRemidationObject
的成员中。 You need to use a global variable or a persistent storage (a database for example). 您需要使用全局变量或永久性存储(例如数据库)。 Try to find where
_assessmentRemidationObject
is resetted before you read it. 尝试在读取
_assessmentRemidationObject
之前将其重置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.