我在删除特定用户后使用response.redirect以使用最新值填充网格..但它给了我错误 lblError.Text =无法计算表达式,因为代码已优化或本机框位于调用堆栈之上。
因为这个错误我没有得到删除的确认任何帮助将不胜感激
代码: - if(chk.Checked == true) {
isDeleted=oFTE.DeleteUserRoleMapDetails(row.Cells[1].Text);
if (isDeleted == 0)
{
lblError.Visible = true;
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Text = "User Role Map deletion failed.";
}
else if (isDeleted == 1)
{
lblError.Visible = true;
lblError.ForeColor = System.Drawing.Color.Red;
//Response.Redirect("userRoleMap.aspx");
Session["Msg"] = "User Role Map deleted successfully.";
Response.Redirect("userRoleMap.aspx",false);
//lblError.Text = "User Role Map deleted successfully.";
break;
}
}
if (iRowCount == gridViewResults.Rows.Count)
{
lblError.Visible = true;
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Text = "Please select a row to delete.";
}
}
}
}
catch (Exception ex)
{
lblError.Visible = true;
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Text = ex.Message.ToString();
}
}
答案 0 :(得分:0)
blError.Text=Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
当您在本机调用中暂停调试器时,仅显示在Locals / Watch窗口中。这不是阻止页面加载的实际错误。也许,问题是你在代码中设置了一个断点,并且在你恢复执行之前,请求是从浏览器中超时的?
答案 1 :(得分:0)
消息来自调试器。在没有调试器的情况下运行应用程序以查看真正的错误。