<td align="left" width="15%" class="body_txt" style="padding-right: 2px; padding-left: 25px;">
<asp:Label ID="lblFirstName" runat="server" Text="First Name:"></asp:Label>
</td>
<td width="35%" align="left" style="padding-left: 25px;">
<asp:TextBox ID="txtFirstName" Width="175px" MaxLength="50" runat="server" CssClass="txt_bx"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidatorFirstName" ControlToValidate="txtFirstName"
SetFocusOnError="true" runat="server" ErrorMessage="*" EnableClientScript="true" ValidationExpression="([a-z]|[A-Z])*"
ForeColor="Black"></asp:RegularExpressionValidator>
</td>
<td width="15%" class="body_txt" align="left" style="padding-right: 2px; padding-left: 25px;">
<asp:Label ID="lblLastName" runat="server" Text="Last Name:"></asp:Label>
</td>
<td width="35%" align="left" style="padding-left: 25px">
<asp:TextBox ID="txtLastName" Width="175px" MaxLength="50" runat="server" CssClass="txt_bx"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidatortxtLastName" EnableClientScript="true" ControlToValidate="txtLastName"
SetFocusOnError="true" runat="server" ErrorMessage="*" ValidationExpression="([a-z]|[A-Z])*"
ForeColor="Black"></asp:RegularExpressionValidator>
</td>
我的驗證工作正常,當我的Response.Redirect後一到這個頁面驗證Server.Transfer的後不工作在asp.net
但是經過一個Server.Transfer的這個頁面驗證停止運轉,形式不上的按鈕進行回傳點擊
代碼背後Pevious頁:
protected void btnEdit_Click(object sender, EventArgs e)
{
try
{
for (int i = 0; i < lstEmployee.Rows.Count; i++)
{
GridViewRow row = lstEmployee.Rows[i];
bool isChecked = ((RadioButton)row.FindControl("RowSelector")).Checked;
if (isChecked)
{
iEmployeeId = Convert.ToInt32(row.Cells[0].Text);
hdnEmployeeId.Value = Convert.ToString(iEmployeeId);
Server.Transfer("EmployeeMaint.aspx", true);
}
}
}
代碼着陸頁的背後:
protected void btnAdd_Click(object sender, EventArgs e)
{
try
{
if (iEmployeeId != 0)
{
UpdateEmployeeDetails(iEmployeeId);
Response.Write("<script> alert('User Updated sucessfully. ');window.location.href='Employee.aspx'; </script> ");
}
else
{
InsertEmployeeDetails();
Response.Write("<script> alert('User Added sucessfully. ');window.location.href='Employee.aspx'; </script> ");
}
}
是否沒有解決此問題的方法? – vini 2013-03-06 07:00:18
使用Response.Redirect無法完成您的工作? – vikbehal 2013-03-06 07:21:51
我必須將多個值從一個頁面傳輸到另一個頁面,這就是爲什麼 – vini 2013-03-06 07:42:03