小编Mik*_*cko的帖子

MVC4 C#如何实现按钮来打印当前信息

我是编程的新手,我有一个按钮,当我点击它时,它会返回上一页.而不是返回上一页的按钮如何让该按钮打印当前信息?

这是我的PrintIndexViewModel类

using NavisionStore.Domain.Entities;

namespace NavisionStore.WebUI.Models
{
    public class PrintIndexViewModel
    {
        public Print Print { get; set; }
        public string ReturnUrl { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的打印控制器

namespace NavisionStore.WebUI.Controllers
{
    public class PrintController : Controller
    {
        private IProductRepository repository;

        public PrintController(IProductRepository repo)
        {
            repository = repo;
        }

        public ViewResult Index(string returnUrl)
        {
            return View(new PrintIndexViewModel
            {
                Print = GetPrint(),
                ReturnUrl = returnUrl
            });
        }
         public RedirectToRouteResult AddtoPrint(int id, string returnUrl)
        {
            Product product = repository.Products
                .FirstOrDefault(p => p.Id == …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc-4

2
推荐指数
1
解决办法
8722
查看次数

标签 统计

asp.net-mvc-4 ×1

c# ×1