Ejemplo n.º 1
0
    protected void _rowdeleting(object sender, GridViewDeleteEventArgs e)
    {
        //String Username = GridView1.DataKeys[e.RowIndex].Value.ToString();

        GridViewRow row      = (GridViewRow)GridView1.Rows[e.RowIndex];
        Label       user     = (Label)row.FindControl("lblusername");
        string      Username = user.Text;



        // instantiate BAL
        Businesslayer pBAL = new Businesslayer();

        try
        {
            pBAL.Delete(Username);

            lblMessage.Text = "Record Deleted Successfully.";
        }
        catch (Exception ee)
        {
            lblMessage.Text = ee.Message.ToString();
        }
        finally
        {
            pBAL = null;
        }

        // GridView1.EditIndex = -1;
        // Refresh the list
        BindGrid();
    }