mardi 31 mars 2015

ComboCox column inside a GridView causing ObjectDisposedException


Vote count:

0




I created a grid view with combobox column inside it. The entity bound to the grid view is Compagne and the entity bound to the combox box is Client (a nested child of Compagne).

Compagne entity (models):



private string nom;
public string Nom
{
get { return nom; }
set { SetPropertyValue<string>("Nom", ref nom, value); }
}

private int site;
public int Site
{
get { return site; }
set { SetPropertyValue<int>("Site", ref site, value); }
}

private int but;
public int But
{
get { return but; }
set { SetPropertyValue<int>("But", ref but, value); }
}

private int statut;
public int Statut
{
get { return statut; }
set { SetPropertyValue<int>("Statut", ref statut, value); }
}

private DateTime dateCreation;
public DateTime DateCreation
{
get { return dateCreation; }
set { SetPropertyValue<DateTime>("DateCreation", ref dateCreation, value); }
}

private DateTime? dateFin;
public DateTime? DateFin
{
get { return dateFin; }
set { SetPropertyValue<DateTime?>("DateFin", ref dateFin, value); }
}
private Client client;
[Association("Client-Compagnes")]
public Client Client
{
get { return client; }
set { SetPropertyValue("Client", ref client, value); }
}


Client entity (models):



private string nom;
public string Nom
{
get { return nom; }
set { SetPropertyValue<string>("Nom", ref nom, value); }
}
private string societe;
public string Societe
{
get { return societe; }
set { SetPropertyValue<string>("Societe", ref societe, value); }
}


GridView Partial:



settings.Columns.Add(c =>
{
c.FieldName = "Nom";
c.Caption = "Nom Compagne";
c.ColumnType = MVCxGridViewColumnType.TextBox;
});
settings.Columns.Add(c =>
{
c.FieldName = "Site";
c.Caption = "Site";
c.Width = Unit.Percentage(5);
c.ColumnType = MVCxGridViewColumnType.SpinEdit;
c.PropertiesEdit.DisplayFormatString = "d";
});
settings.Columns.Add(c =>
{
c.FieldName = "But";
c.Caption = "But";
c.Width = Unit.Percentage(8);
c.ColumnType = MVCxGridViewColumnType.SpinEdit;
c.PropertiesEdit.DisplayFormatString = "d";
});
settings.Columns.Add(c =>
{
c.FieldName = "StatutU";
c.Caption = "Statut";
c.UnboundType = DevExpress.Data.UnboundColumnType.Boolean;
c.Width = Unit.Percentage(5);
c.UnboundExpression = "[Statut] == 1";
c.ColumnType = MVCxGridViewColumnType.CheckBox;
});
settings.Columns.Add(c =>
{
c.FieldName = "DateCreation";
c.Caption = "Date de Création";
c.ColumnType = MVCxGridViewColumnType.DateEdit;
c.PropertiesEdit.DisplayFormatString = "g";
});
settings.Columns.Add(c =>
{
c.FieldName = "DateFin";
c.Caption = "Date de Fin";
c.ColumnType = MVCxGridViewColumnType.DateEdit;
c.PropertiesEdit.DisplayFormatString = "d";
});
settings.Columns.Add(c =>
{
c.FieldName = "Client.Societe";
c.Caption = "Client";
c.ColumnType = MVCxGridViewColumnType.ComboBox;
var comboBoxProperties = c.PropertiesEdit as ComboBoxProperties;
comboBoxProperties.DataSource = AppointmentTool.Models.DataHelper.GetClients();
comboBoxProperties.TextField = "Societe";
comboBoxProperties.ValueField = "Oid";
comboBoxProperties.ValueType = typeof(int);
});


I omitted some code from the gridview partial view that is no related to the problem.


Controller:



[ValidateInput(false)]
public ActionResult CompagneAdminGridViewPartial()
{
UnitOfWork uow = new UnitOfWork();
var model = new XPCollection<Compagne>(uow);
return PartialView("_CompagneAdminGridViewPartial", model);
}


All fiel


And The error is:



Exception Details: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'ASTDataLayer.DAO.Client(2)'.


asked 1 min ago

Fourat

130






ComboCox column inside a GridView causing ObjectDisposedException

Aucun commentaire:

Enregistrer un commentaire