public void clear()
{
txtSubcategorycode.Text = "";
txtSubcategoryname.Text = "";
txtSubcategoryDesc.Text = "";
ddlCategories.SelectedIndex = 0;
}
 
protected void btnCancel_Click(object sender, EventArgs e)
        {
            int rowIndex = 0;
            StringCollection sc = new StringCollection();
            if (ViewState["CurrentTable"] != null)
            {
                DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"];
                //DataRow drCurrentRow = null;
                if (dtCurrentTable.Rows.Count > 0)
                {
                    for (int i = dtCurrentTable.Rows.Count-1; i >=1; i--)
                    {
                       // dtCurrentTable.Rows.Remove(dtCurrentTable.Rows[i]);
                        dtCurrentTable.Rows[i].Delete();
                        rowIndex--;
                    }
                }
            }
            clear();
            lblresult.Text = "";
        }