user6592730 user6592730 - 2 months ago 15
ASP.NET (C#) Question

How to reset a gridview?

I have a gridview which takes inputs from a textbox. Multiple values can be added to it. I want to rest the grid. I have tried few codes in the internet. But just clear the grid. When i type the numbers again all the previous numbers appear. I want to remove previous numbers too when i reset the grid. How can i do it?

Here is my back end code

if (grdPolicyDetails.Rows.Count > 0)
{
grdPolicyDetails.Columns.Clear();
grdPolicyDetails.DataBind();
}


I have tried this code too. This too didn't work.

grdPolicyDetails.DataSource = null;
grdPolicyDetails.DataBind();

Answer

Are you talking about the History of Browser ? if yes then,

If Clear Gridview Data then,

grdpolicydetails.Controls.Clear();
Comments