Skip to content

Instantly share code, notes, and snippets.

@daltonnyx
Last active July 1, 2017 04:07
Show Gist options
  • Save daltonnyx/805dcf42790305949df2d59e4e157607 to your computer and use it in GitHub Desktop.
Save daltonnyx/805dcf42790305949df2d59e4e157607 to your computer and use it in GitHub Desktop.
C# XAF List Editor Note
// To customize ListEditor, we need to hook PagePreRender from ViewController to make sure every Editor has been created.
// Refer: https://www.devexpress.com/Support/Center/Question/Details/Q574048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.Data.Filtering;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Layout;
using DevExpress.ExpressApp.Model.NodeGenerators;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp.Templates;
using DevExpress.ExpressApp.Utils;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.Validation;
using iPC.Module.BusinessObjects;
using DevExpress.ExpressApp.Web;
using DevExpress.ExpressApp.Web.Editors.ASPx;
using DevExpress.ExpressApp.Web.Templates.ActionContainers;
using DevExpress.Web;
namespace iPC.Module.Web.Controllers
{
// For more typical usage scenarios, be sure to check out https://documentation.devexpress.com/eXpressAppFramework/clsDevExpressExpressAppViewControllertopic.aspx.
public partial class FilesUploadViewController : ViewController<ListView>
{
public FilesUploadViewController()
{
InitializeComponent();
// Target required Views (via the TargetXXX properties) and create their Actions.
TargetObjectType = typeof(FileDinhKem);
}
protected override void OnActivated()
{
base.OnActivated();
// Perform various tasks depending on the target View.
WebWindow.CurrentRequestWindow.PagePreRender += CurrentRequestWindow_PagePreRender;
}
private void CurrentRequestWindow_PagePreRender(object sender, EventArgs e)
{
if (Frame?.Template != null && View != null && View.Editor is ASPxGridListEditor)
{
ASPxGridListEditor gridListEditor = (ASPxGridListEditor)View.Editor;
gridListEditor.Grid.ClientInstanceName = "__Files__Uploaded__";
}
}
protected override void OnViewControlsCreated()
{
base.OnViewControlsCreated();
// Access and customize the target View control.
}
protected override void OnDeactivated()
{
// Unsubscribe from previously subscribed events and release other references and resources.
base.OnDeactivated();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment