using System;
using System.Web.UI.WebControls;
using System.Data;
/*
* The Control assumes the following:
*
* 1) It is bound to a DataView object.
* 2) The app will use direct SQL commands to update the source (NO batch update).
* 3) No custom paging is enabled.
*
* If you plan to support sorting, then some aspects of this code should be reviewed
* and adapted.
*
*/
namespace BWSLib
{
namespace Controls
{
public class EditableGrid : DataGrid
{
// Constructor that sets some styles and graphical properties
public EditableGrid()
{
AllowFullEditing = true;
AddNewRow = false;
RejectChanges = false;
MustInsertRow = false;
AllowPaging = true;
// Handlers
Init += new EventHandler(OnInit);
PageIndexChanged += new DataGridPageChangedEventHandler(OnPageIndexChanged);
ItemCreated += new DataGridItemEventHandler(OnItemCreated);
CancelCommand += new DataGridCommandEventHandler(OnCancelCommand);
EditCommand += new DataGridCommandEventHandler(OnEditCommand);
UpdateCommand += new DataGridCommandEventHandler(OnUpdateCommand);
DeleteCommand += new DataGridCommandEventHandler(OnDeleteCommand);
}
// PROPERTY: AllowFullEditing
// Enable full editing
public bool AllowFullEditing;
// PROPERTY: AddNewRow
// if true must add an empty row at the bottom of the data source
public bool AddNewRow;