Hide Row Gridview C# / ASPX

Asked

Viewed 168 times

1

In a GridView users, if the user himself clicks edit/delete his own account, he would like to know how to hide the Row or disable the GridView but only for the logged-in user, or if clicking the edit/delete button gives an error to prevent the user from being deleted/edited.

I tried something like this:

            if (IDUtilizador == Convert.ToInt32(Session["IDUtilizador"]))
            {
                lblUtilizadoresInfo.ForeColor = System.Drawing.Color.Red;
                lblUtilizadoresInfo.Text = "Operação mal sucedida, para alterar as definições de newsletter, acesse Front Office, 'Minha Conta', 'Assinaturas'.";
                lblUtilizadoresInfo.Visible = true;
                MultiViewContentInfo.Visible = true;
                GridViewManage.DataBind();
            }
        }

But that way whenever I click the back button of the browser I can edit this user, being a huge bug.

Thank you.

  • It was already solved, it was an error between Userid Séssions.

1 answer

0

Try something like that:

 if (IDUtilizador == Convert.ToInt32(Session["IDUtilizador"]))
        {
            btn_EditarApagar.Enabled = false
            ...
        }
    }
  • In that situation will disable the button for all users?

  • Yeah, it really does, put on an E-l...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.