private void SelectParts(string machineMaintId) { try { using (var sqlConnection = new SqlConnection(connectionString)) { sqlConnection.OpenAsync(); var dynamicParameters = new DynamicParameters(); dynamicParameters.Add("machine_maint_id", machineMaintId, DbType.String, ParameterDirection.Input); IEnumerable <ScannerData> result = sqlConnection.Query <ScannerData>( "sp_machine_maint_parts_select", dynamicParameters, commandType: CommandType.StoredProcedure); GridViewMachineMaintParts.DataSource = result; GridViewMachineMaintParts.DataBind(); } } catch (Exception e) { SetErrorMessage("Error: " + e.Message); } }
private void ClearParts() { GridViewMachineMaintParts.DataSource = null; GridViewMachineMaintParts.DataBind(); ClearErrorMessage(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GridViewMachineMaint.DataSource = null; GridViewMachineMaint.DataBind(); GridViewMachineMaintParts.DataSource = null; GridViewMachineMaintParts.DataBind(); return; } ; }