As in thread http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15019 I'm trying to limit the fields loaded to a bound ASPxGridView by default, but load them all for the individual row when the grid is set to edit mode.
I'm trying to follow Walaa's advice:
You should disable LivePersistence and pass the ExcludeIncludeFieldsList collection to the fetch method in the PerformSelect event handler.
however it's not clear to me how to do this using the properties or methods of either the PerformSelectEventArgs2 or LLBLGenProDataSource2 classes.
Here's what I've got so far:
<dxwgv:ASPxGridView ID="gridMain" runat="server" DataSourceForceStandardPaging="true" SkinID="EditableAddDelete" AutoGenerateColumns="False" DataSourceID="dsMain" KeyFieldName="ID"
OnStartRowEditing="gridMain_StartRowEditing">
<Columns>
*removed for brevity*
</Columns>
</dxwgv:ASPxGridView>
<llblgenpro:LLBLGenProDataSource2 ID="dsMain" runat="server" CacheLocation="ASPNetCache" EnablePaging="True" AdapterTypeName="LLBLGen.ConservationEvidence.DatabaseSpecific.DataAccessAdapter, LLBLGen.ConservationEvidenceDBSpecific" DataContainerType="EntityCollection" EntityFactoryTypeName="LLBLGen.ConservationEvidence.FactoryClasses.CaseWithAffiliationIDEntityFactory, LLBLGen.ConservationEvidence" OnPerformSelect="dsMain_PerformSelect">
</llblgenpro:LLBLGenProDataSource2>
protected ExcludeIncludeFieldsList GetExcludedFieldList()
{
ExcludeIncludeFieldsList excludedFields = new ExcludeIncludeFieldsList();
excludedFields.Add(CaseFields.Summary);
excludedFields.Add(CaseFields.Action);
excludedFields.Add(CaseFields.Consequences);
excludedFields.Add(CaseFields.Background);
}
/// <summary>
/// include excluded fields when the row is edited
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void gridMain_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
{
List<int> entityIndex = dsMain.EntityCollection.FindMatches(CaseFields.ID = e.EditingKeyValue);
if (entityIndex.Count > 0)
using (DataAccessAdapter adapter = new DataAccessAdapter())
adapter.FetchExcludedFields(dsMain.EntityCollection[entityIndex[0]], GetExcludedFieldList());
}
/// <summary>
/// exclude large fields from the collection bound to the grid
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void dsMain_PerformSelect(object sender, PerformSelectEventArgs2 e)
{
// **************************************************
// how do I plumb in the GetExcludedFieldList() here?
// **************************************************
e.
dsMain.
}
Can you let me know if I'm on the right track and how I should finish off dsMain_PerformSelect?
LLBLGen Pro 2.5 Final, ASPxGridView 8.2.4, ASP.NET 2, Adapter, SQL Server 2005
Many thanks
Rich