简体   繁体   中英

Asp.net Response.Redirect

I am using response.redirect after iam deleting a particular user to have grid populated with latest values.. but it giving me error lblError.Text=Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

because of this error iam not getting confirmation of deletion any help will be appreciated

code:- 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();
        }           
    }      
blError.Text=Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

Is only shown in the Locals/Watch windows when you've paused the debugger inside a native call. It's not an actual error preventing your page from loading. Perhaps, the problem is that you've set a breakpoint in your code and the request is timing out from the browser before you've resumed execution?

The message is coming from the debugger. Run your application without the debugger to see the real error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM