I am trying to delete a selected row in the gridview, the User has a option of selecting the row to be deleted and he can delete only one row at a time. How can this be done.
Under the .CS page i have written the following code.
protected void gdvData_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
InBoundDataBO obj = new InBoundDataBO();
int SUPPLIER_NUMBER = Convert.ToInt32(gdvData.Rows[e.RowIndex].Cells[4].Text);
string SOURCE_ENTITY = gdvData.Rows[e.RowIndex].Cells[2].Text.ToString();
string PLANT_CODE = gdvData.Rows[e.RowIndex].Cells[3].Text.ToString();
string SUPPLIER_GROUP_NUMBER = gdvData.Rows[e.RowIndex].Cells[5].Text.ToString();
obj.DeleteSupplierDetails(SUPPLIER_NUMBER, SOURCE_ENTITY, PLANT_CODE, SUPPLIER_GROUP_NUMBER);
}
Under the Data Acess Layer i have written the following method.
public static void DeleteSupplierDetails(String R1, String R2, String R3, String R4,out String message)
{
message = String.Empty;
Database db = Helper.CreateDatabase();
DbCommand cmd = db.GetStoredProcCommand("PDSS_STAGING_DEV.Delete_SupplierDetails");
cmd.CommandType = CommandType.StoredProcedure;
db.AddInParameter(cmd, "P_SOURCE_ENTITY", DbType.String, R1);
db.AddInParameter(cmd, "P_PLANT_CODE", DbType.String, R2);
db.AddInParameter(cmd, "P_SUPPLIER_NUMBER", DbType.String, R3);
db.AddInParameter(cmd, "P_SUPPLIER_GROUP_NUMBER", DbType.String, R4);
db.AddOutParameter(cmd,"P_RETURN_MSG", DbType.String,10);
db.ExecuteNonQuery(cmd);
message = cmd.Parameters["P_RETURN_MSG"].Value.ToString().Trim();
}