views:

94

answers:

3

Hi there,

I have a gridview in an asp.net page, and get the data by binding it to a SQL Server Table, I use C# and Stored Procedure in SQL server to bind the data. every thing works fine,except when I Delete multiple rows by using Stored Procedure, the gridview still shows the old data. actually I have couple of text boxes that the user can enter the data and an asp button,as soon as user click the button, in code behind I call the Stored procedure and delete the data.

How could I Reload / Refresh the page? after deleting the rows?

Thanks in advance

+1  A: 

Just rebind your data to the gridview with another call to the database.

GridView1.DataSource = GetData();  //get your data with your original stored proc
GridView1.DataBind();
Steve Danner
+2  A: 

Hey,

If you are using a datasource control (you supplied the datasourceid property), you have to call Grid.DataBind().

If you use the DataSOurce property of the grid, you have to reload the data source into that property from the database and call databind().

Brian
A: 

You could delete the rows in your datasource and rebind it to the grid to avoid retrieving data from the database again.

Drahcir