Interviews - C# Corner

Pavan Satpute
Can I send HTML string to Controller? if Yes then How.?
By Pavan Satpute in ASP.NET onMay 25 2015
  • Sourabh Dwivedi
    Aug, 2015 19

    May be it'll be helpful for you - Index.csHtml ------------------------ @{ ViewBag.Title = "title"; Layout = "~/Views/Shared/_Layout.cshtml"; }

    title

    Controller.CS ------------------------ using System.Web.Mvc; namespace MvcPlayground.Controllers { public class StackController : Controller { // // GET: /Stack/ public ActionResult Index() { return View(); } public ActionResult Create(FormCollection form) { string htmlStr = form["content"].ToString(); return View("Index"); } } }

    • 0
  • Khan Abrar Ahmed
    Jun, 2015 16

    Yes you can, there is two ways 1. Using web.config ---> appsettings 2. Put one attribute ([ValidateInput(false)]) onto the action that you want to posting back on the server side

    • 0
  • Munesh Sharma
    Jun, 2015 16

    http://stackoverflow.com/questions/16682450/passing-string-with-html-tags-to-controller-in-asp-net-mvc

    • 0
  • Pavan Satpute
    May, 2015 25

    Yes we can send HTML string to Controller. we need to put [ValidateInput(false)] on the action method on controller side.

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS