Thursday, October 1, 2009

Open ListView on Navigation Click

To do this you have to write a Controller and inherit it with ShowNavigationItemController Now add the code below
protected override void ShowNavigationItem(SingleChoiceActionExecuteEventArgs args)
{
base.ShowNavigationItem(args);
if ((args.SelectedChoiceActionItem != null)  &&  args.SelectedChoiceActionItem.Enabled)
 {
 if (args.SelectedChoiceActionItem.Id == "Shipment_ListView")
 {
ObjectSpace os = Application.CreateObjectSpace();
 DevExpress.ExpressApp.ListView lv = Application.CreateListView(os, typeof(DispatchRegister), true); args.ShowViewParameters.CreatedView = lv;
args.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow; args.ShowViewParameters.CreateAllControllers = true;
DialogController dc = new DialogController(); args.ShowViewParameters.Controllers.Add(dc); dc.Accepting += new EventHandler(dc_Accepting);
}
}
}
Now Write Code on Accepting
void dc_Accepting(object sender, DialogControllerAcceptingEventArgs e)
 {
ObjectSpace os=Application.CreateObjectSpace ();
DevExpress.ExpressApp.ListView lv = ((DevExpress.ExpressApp.ListView)((WindowController)sender).Window.View);
Shipment sp = null;
CollectionSource cs = new CollectionSource(os, typeof(Shipment));
CollectionSourceBase cs1 = (CollectionSourceBase)lv.CollectionSource;
foreach (DispatchRegister dr in lv.SelectedObjects)
{
 sp = new Shipment(os.Session);
sp.BlockNo = dr.DeliveryNumber;
sp.ChallanNo = dr.DistributionChannel;
cs.Collection.Add(os.GetObject (sp));
 }
 DevExpress.ExpressApp.ListView listView = Application.CreateListView("Shipment_ListView", cs, true); e.ShowViewParameters.CreatedView = listView;
e.ShowViewParameters.TargetWindow = TargetWindow.Default;
 }

No comments:

Post a Comment

Mat Table Angular

Mat Table in Angular Mat table is used to display data . its a material designed styled data-table . For using Material Table MatTableMo...