我有一些这样的代码如下:能见度/标签的隐形在
if {
this.showhide.ImageUrl = "../common/images/hide-icon.png";
this.showhide.AlternateText = "Hide SearchBar";
this.searchBar.Visible = false;
Session["showHideImage"] = "hide";
ScreenProjectSearch ProjSearch = CurrentProjectSearch;
lblTypeOfSearch.Text = "Search results are based on";
string typeOfSearch = string.Empty;
if (CurrentProjectSearch != null)
{
//lblTypeOfSearch.Text = "Search results are based on";
if (CurrentProjectSearch.IsFileName)
typeOfSearch += " Filename " + ProjSearch.TextSearch.Trim();
if (CurrentProjectSearch.IsDescription)
typeOfSearch += " Description " + ProjSearch.TextSearch.Trim();
if (CurrentProjectSearch.IsPartNumber)
typeOfSearch += " PartNumber " + ProjSearch.TextSearch.Trim();
if (CurrentProjectSearch.IsState)
{
if (CurrentProjectSearch.IsDevelopment)
typeOfSearch += " Development State ";
if (CurrentProjectSearch.IsValidation)
typeOfSearch += " Validation State ";
if (CurrentProjectSearch.IsValidationPendingApproval)
typeOfSearch += " ValidationPendingApproval State ";
if (CurrentProjectSearch.IsPilot)
typeOfSearch += " Pilot State ";
if (CurrentProjectSearch.IsFactory)
typeOfSearch += " Factory State ";
if (CurrentProjectSearch.IsCancel)
typeOfSearch += " Cancel State ";
}
if (CurrentProjectSearch.IsDate)
typeOfSearch += " Created Date From: " + ProjSearch.FromDate + " To: " + ProjSearch.ToDate;
if (CurrentProjectSearch.IsPromoteDate)
typeOfSearch += " Promoted Date From: " + ProjSearch.FromPromoteDate + " To: " + ProjSearch.ToPromoteDate;
if (CurrentProjectSearch.IsCreatedBy)
typeOfSearch += " Created By: " + ProjSearch.CreatedBy.ToString();
if (CurrentProjectSearch.IsProjectIDs)
typeOfSearch += " PrjoectIds: " + ProjSearch.ProjectIDs;
if (CurrentProjectSearch.IsWorkFlow)
{
if (CurrentProjectSearch.IsMdiagsNormal)
typeOfSearch += " WorkFlow: " + "Mdiags Normal";
if (CurrentProjectSearch.IsMdiagsTestEngineer)
typeOfSearch += " WorkFlow: " + "Mdiags TestEngineer";
}
if (!string.IsNullOrEmpty(typeOfSearch))
{
lblTypeOfSearch.Text += typeOfSearch;
lblTypeOfSearch.Visible = true;
}
}
}
我想如果一些文本追加到它时,typeOfSearch
不为空,在Page_Load
显示此lblTypeOfSearch
。如果我检查Page_Load
中的值,它在那里显示为空。我怎样才能利用这个变量来显示?
只是调试巨兽,看看实际发生了什么... – walther 2014-09-06 08:29:24
此代码是在按钮单击。标签在按钮点击事件中添加文本。如果我想再次使用相同的文本,我如何在页面加载方法中使用它? – user3356020 2014-09-06 08:42:38