---
title: "GridView is hiding after Row Deleting Event"  
description: "GridView is hiding after Row Deleting Event"  
author: "Mark Devid"  
published: 2014-03-06  
updated: 2014-03-06  
canonical: https://www.mindstick.com/forum/1978/gridview-is-hiding-after-row-deleting-event  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# GridView is hiding after Row Deleting Event

I am using [GridView Row](https://www.mindstick.com/forum/33990/attach-multiple-files-gridview-row-in-knockout-js) [command](https://www.mindstick.com/blog/178/synchronous-and-asynchronous-command-execution-in-c-sharp-dot-net) [Event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) for deleting row from Gridview, I have added RowDeleting Event of gridview, but after deleting the GridView is getting hide. Below is my code

protected void Page_Load(object sender, EventArgs e)

{

if (!Page.IsPostBack){

LoadData()//Here I am databinding the Grid

}

}

[private](https://www.mindstick.com/blog/11097/java-access-modifiers-the-public-and-the-private-modifiers) void LoadData()

{

var [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science)=MyClass.GetRecords();//it returns [DataTable](https://www.mindstick.com/blog/195/datatable-in-ado-dot-net)

dg.DataSource=data;

dg.DataBind();

}

protected void dg_RowCommand(Object sender, GridViewCommandEventArgs e)

{

if(e.CommandName =="del")

{

//[Delete](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) [Records](https://www.mindstick.com/forum/34640/how-to-create-a-stored-procedure-for-display-all-records)

dg.DataBind();

}

}

[public void](https://www.mindstick.com/interview/2715/can-we-write-static-public-void-instead-of-public-static-void) dg_RowDeleting(Object sender, GridViewDeleteEventArgs e)

{

dg.DataBind();

}

## Replies

### Reply by Pravesh Singh

Hi Mark,\

My guess is you are missing DataSource after deleting the rows.

Try this

protected void dg_RowCommand(Object sender, GridViewCommandEventArgs e)

{

if(e.CommandName =="del")

{

//Delete Records

LoadData();

}

}

public void dg_RowDeleting(Object sender, GridViewDeleteEventArgs e)

{

LoadData();

}


---

Original Source: https://www.mindstick.com/forum/1978/gridview-is-hiding-after-row-deleting-event

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
