protected void InitializeCountryList(DropDownList DDL) { CountryDataSource.DataBind(); DDL.DataSourceID = "CountryDataSource"; DDL.DataTextField = "countryname"; DDL.DataValueField = "countryid"; DDL.DataBind(); DDL.Items.Insert(0, "-Select Country-"); }
protected void DeleteRow(object sender, GridViewDeletedEventArgs e) { if (e.Exception == null) { lblMessError.Visible = false; CountryDataSource.DataBind(); dgCountry.DataBind(); } else { e.ExceptionHandled = true; lblMessError.Text = "Delete operation is fail because the data you deleted is still referenced by other data"; lblMessError.Visible = true; } }