case
是否可以使用带有语句的IFswitch
语句?我尝试了以下代码,但没有任何反应。我已经验证 SectionID 不等于 -1 但页面不处理任何内容,它不会触发orServer.Transfer
也不会将分配传播到ListView
or Labels
。
case "Media":
if (SectionID != "-1") { Server.Transfer("/Staff/Section.aspx"); }
lvSearchResults.DataSource = SQLHelper.GetDataByQuery("SELECT SectionID AS ID, ShortName AS Title, Synopsis AS Descript, 'Section' AS PageName FROM dbo.tblSectionInfo WHERE ShortName != 'Unknown' ORDER BY SectionTitle");
lvSearchResults.DataBind();
lblTitleRow.Text = "Add Section";
lblDescriptionRow.Text = "Add new section home page.";
btnAddNewItem.PostBackUrl = "/Staff/Section.aspx";
break;