<asp:content id="Content1" runat="Server" contentplaceholderid="ContentPlaceHolder1">
<div id="Scope1">
.
.
.
.
<asp:label id="lblValue" runat="server" visible="False">2</asp:label>
</contenttemplate>
</asp:updatepanel>
</div>
<asp:hiddenfield id="hidValue" value="2" runat="server">
</asp:hiddenfield></asp:content>
並在Verification.aspx.cs裡加入如以下程式
protected void Page_Load(object sender, EventArgs e)為了此問題..去詢問了一下GOOGLE大神,嘗試過
{
if ( hidValue.Value == "2")
grdVerify.DataSource = AppCase.SelectVerifyingCases();
else
grdVerify.DataSource = AppCase.SelectVerifyingCases(hidValue.Value);
grdVerify.DataBind();
}
///
/// 案件篩選..
///
///
///
protected void lbtnUrgent_Click(object sender, EventArgs e)
{
switch (((LinkButton)sender).ID)
{
// 0:一般案件 1:搶修案件 2:全部案件
case "lbtnUrgent":
hidValue.Value = "1";
grdVerify.DataSource = AppCase.SelectVerifyingCases(hidValue.Value);
break;
case "lbtnNormal":
hidValue.Value = "0";
grdVerify.DataSource = AppCase.SelectVerifyingCases(hidValue.Value);
break;
case "lbtnAll":
hidValue.Value = "2";
grdVerify.DataSource = AppCase.SelectVerifyingCases();
break;
}
- 刪除該HiddenField並重新加入
- 直接重新Rebuild(因看到有人Rebluild後就解決問題了)
well, first of all, having 2 default.aspx pages is ok as long as your class name for your codebehind is different from one another. maybe it's conflicting.
讓我想到..我很久之前為了先暫存原始檔案而將該檔案進行複制並重新命名為Verification1.aspx,而該檔案也是
public partial class Authority_Verification: System.Web.UI.Page
{……} 開頭,後來將Verification1.aspx(舊的檔案)刪除後再重新Rebluild即不會再出現『hidValue不存在於目前內容中 』的訊息。