根据下面的代码,在获取一些值(newrev,newreview)并放入变量后,我需要将它们放入标签中(“some text”+newrev)。但我有问题(newrev)在当前上下文中不存在。
Label1.Text = "Review Number:" + newReview + "(for preparing of Rev." + newrev+")";
protected void ddlProjectDocument_SelectedIndexChanged(object sender, EventArgs e)
{
_DataContext = new EDMSDataContext();
var x = ddlProjectDocument.SelectedValue;
var MaxRev = (from rev in _DataContext.tblTransmittalls
where rev.DocID.ToString() == ddlProjectDocument.SelectedValue
select rev.REV).Max();
if (MaxRev == null)
{
var newRev = 0;
}
else
{
var newRev = Convert.ToInt32(MaxRev) + 1;
}
var MaxReview = (from rev in _DataContext.tblFiles
where (rev.DocId.ToString()==ddlProjectDocument.SelectedValue)&&
(rev.Rev.ToString()==MaxRev)
select rev.Review).Max();
if (MaxReview == null)
{
var newReview = 1;
}
else
{
var newReview = Convert.ToInt32(MaxReview) + 1;
}
Label1.Text = "Review Number:" + newReview + "(for preparing of Rev." + newrev+")";
}