In ASP.NET MVC, how do I get the mangled name of a control when a form is submitted?

I've got a form inside an <asp:Content> block that is being submitted to a controller. For one of the controls, I need to get some information from it directly that won't happen automatically by calling UpdateModel().

However, in the Request.Form dictionary, the control's id is of the mangled form ctl00$ContentPlaceHolder${name}. Given that I'm in the controller, and know nothing about the view at this point, what is the proper way of accessing the control's data?

Here is what the view (.aspx) looks like (removed extraneous code):

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" AutoEventWireup="true"
    CodeBehind="...." Inherits="...." %>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder" runat="server">

    <form id="form1" action="..." method="post">

            <FCKeditorV2:FCKeditor ID="AuthorBio" runat="server" Height="250"/>
            <input type="submit" value="Save" />


The control named AuthorBio shows up in the controller in the Form.Request dictionary as ctl00$ContentPlaceHolder$AuthorBio$

The reason I'm trying to use the 3rd-party control with "runat-server" is because I need to set the editor's Value as follows:

AuthorBio.Value = HttpUtility.HtmlDecode(ViewData.Model.Bio);

Trying to do this in the .aspx file in the FCKeditorV2 tag doesn't work. (Or maybe I'm missing something there too)

Ok, so the key is to use the JavaScript version of the editor rather than the wrapped control. There was also a handy comment that I'm going to include here to accompany the accepted answer:

you should use the javascript version of the FCKEditor control not the .NET custom control as the .NET custom control was built on the WebForms paradigm. The JS version should have a hidden field for the value of the Html which you can access in your controller using Request["FieldName"]


FCKEditor is a standard javascript library that also comes wrapped in an ASP.NET control for Webforms. So it would be easier to use the FCKEditor javascript without the ASP.NET control. It will be easier to integrate into MVC that way.

If you must use the ASP.NET control version then you will have these kinds of issues. But one solution is to place the FCKeditor on a standard webforms page and then show that in a dialog using something like Greybox.

Need Your Help

Integrating jprobe with eclipse?

java jvm profiler jprobe

I integrated Jprobe with eclipse Indigo as per this link. But when i try to start