none
how do I: Send text string to printer on webpage RRS feed

  • Question

  • Hi

    Just saying, im a complete rookie! So it is understandable if you think im stupid... ;)

    I've used a template (MVC - ASP.NET Web application with .NET Framework) to generate a webpage.

    In the Home-folder, I've altered one of the "website pages" (Printer.cshtml) to this:

    <body>
        <article>
            <header>
                <h1>@ViewBag.Message</h1>
            </header>
    
            <form>
                <p>
                    x:
                    <input type='text' name='print_x' />
    
                    y:
                    <input type='text' name='print_y' />
                </p>
    
                <p>
                    z:
                    <input type='text' name='print_z' />
                </p>
                <input type='submit' value='Print' OnClick='button' />
            </form>
        </article>
    </body>

    with the Controller (in the Controllers-folder):

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    
    // Controls what is showed using Views
    
    namespace WebApplication1.Controllers
    {
        public class HomeController : Controller
        {
            public ActionResult Index()
            {
                         return View();
            }
    
            public ActionResult About()
            {
                ViewBag.Message = "Your application description page."; // 
    
                return View();
            }
    
            public ActionResult Printer()
            {
                ViewBag.Message = "Your printer page.";
    
                return View();
            }
        }
    }

    Now to my question:

    How do I, when someone on the webpage press the "Print" buttom, send print_x, print_y and print_z to a printer?

    Thanks in advance.



    • Moved by Sabah ShariqMVP Tuesday, January 2, 2018 11:21 AM Moved From Visual C#
    Tuesday, January 2, 2018 11:02 AM

All replies

  • Hi MFS1991,

    This is Visual C# forum. As your issue is related to Web please ask your question into ASP.Net forum for getting quick response. I am moving your thread to off topic.

    https://forums.asp.net/

    Your understanding and cooperation will be grateful.

    Thanks,
    Sabah Shariq

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered "Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]

    Tuesday, January 2, 2018 11:20 AM