1
我正在開發員工Web應用程序項目,在我的應用程序中,我使用了2個更新面板,隱藏字段和按鈕。實際上我正在做的是點擊按鈕,我需要獲得下一個員工信息並保存此信息。並在這裏每當我點擊更新panel2中的按鈕,獲取員工信息,我會保持這個員工id隱藏字段,在更新panel1和調試隱藏字段值顯示正確的員工id,但節省時間其舊值。爲此我面臨很多問題,請幫助我。 謝謝更新面板中的隱藏字段值未正確更新
這裏是我的代碼:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="border-left: 1px solid #CDCDCD; border-right: 1px solid #CDCDCD; background-color: #E9E9E9">
<asp:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true"
AsyncPostBackTimeout="36000" />
<div>
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="60000">
</asp:Timer>
</div>
<div align="left" style="width: 715px; background: #E9E9E9;">
<div style="margin: 0px 30px 0px 45px; line-height: 140%; border-bottom: 1px solid #E0E2E0;
padding: 10px 0px 15px 0px">
<asp:UpdatePanel ID="upNextChapter" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table width="100%">
<tr>
<td align="right">
<asp:HiddenField ID="hfEmpId" runat="server" Value="0" />
** Employee Info **
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="imgbtnNext" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
<div align="right" style="padding-right: 30px;">
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ImageButton ID="imgbtnNext" runat="server" OnClick="imgbtnNext_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div align="center">
</div>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
後面的代碼:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void imgbtnNext_Click(object sender, EventArgs e)
{
//Get Employee Info & store it in Hidden field value=Employee Id
//** Saving Employee Info using Hidden filed value **
}
}
請提供您的應用程序的一些代碼。 –
如果有人出現並將隱藏值重寫爲新ID並提交頁面,會發生什麼情況? – asawyer
它會更新舊員工信息 –