Example #1
0
        public ActionResult Index()
        {
            ViewBag.Message          = "Welcome to DevExpress Extensions for ASP.NET MVC!";
            ViewData["CategoryList"] = MyModel.GetCategories();
            ViewData["ProductList"]  = MyModel.GetProducts();

            return(View());
        }
 public ActionResult Index()
 {
     return(View(new MyViewModel {
         Categories = MyModel.GetCategories(), Products = MyModel.GetProducts(0)
     }));
 }
 public ActionResult GridViewPartialCategories()
 {
     return(PartialView(MyModel.GetCategories()));
 }
        public ActionResult ExportTo()
        {
            var ps = new PrintingSystemBase();

            var headerImageLink = new LinkBase(ps);

            headerImageLink.CreateDetailArea += headerImageLink_CreateDetailArea;

            var link1 = new PrintableComponentLinkBase(ps);
            GridViewSettings categoriesGridSettings = new GridViewSettings();

            categoriesGridSettings.Name         = "gvCategories";
            categoriesGridSettings.KeyFieldName = "CategoryID";
            categoriesGridSettings.Columns.Add("CategoryID");
            categoriesGridSettings.Columns.Add("CategoryName");
            categoriesGridSettings.Columns.Add("Description");
            link1.Component = GridViewExtension.CreatePrintableObject(categoriesGridSettings, MyModel.GetCategories());

            var compositeLink = new CompositeLinkBase(ps);

            compositeLink.Links.AddRange(new object[] { headerImageLink, link1 });
            compositeLink.CreateDocument();

            FileStreamResult result = CreateExcelExportResult(compositeLink);

            ps.Dispose();

            return(result);
        }
Example #5
0
        public ActionResult ExportTo(int MasterRowKey)
        {
            var ps = new PrintingSystemBase();

            var link1 = new PrintableComponentLinkBase(ps);
            GridViewSettings categoriesGridSettings = new GridViewSettings();

            categoriesGridSettings.Name         = "gvCategories";
            categoriesGridSettings.KeyFieldName = "CategoryID";
            categoriesGridSettings.Columns.Add("CategoryID");
            categoriesGridSettings.Columns.Add("CategoryName");
            categoriesGridSettings.Columns.Add("Description");
            link1.Component = GridViewExtension.CreatePrintableObject(categoriesGridSettings, MyModel.GetCategories());

            var link2 = new PrintableComponentLinkBase(ps);
            GridViewSettings productsGridSettings = new GridViewSettings();

            productsGridSettings.Name         = "gvProducts";
            productsGridSettings.KeyFieldName = "ProductID";
            productsGridSettings.Columns.Add("ProductID");
            productsGridSettings.Columns.Add("ProductName");
            productsGridSettings.Columns.Add("CategoryID");
            productsGridSettings.Columns.Add("UnitPrice");
            link2.Component = GridViewExtension.CreatePrintableObject(productsGridSettings, MyModel.GetProducts(MasterRowKey));

            var compositeLink = new CompositeLinkBase(ps);

            compositeLink.Links.AddRange(new object[] { link1, link2 });
            compositeLink.CreateDocument();

            FileStreamResult result = CreateExcelExportResult(compositeLink);

            ps.Dispose();

            return(result);
        }
Example #6
0
 public ActionResult GridCategoriesAction()
 {
     return(PartialView("GridCategories", MyModel.GetCategories()));
 }