tags:

views:

35

answers:

1

Is there anyway to retrieve a HTML element's class or ID in the controller class? Say for example, I have the following View:

       <fieldset id="FeatureSelectField">
            <legend>Extra Features</legend>
            <div id="DeluxeFeatureID">
            <%= Html.CheckBox("DeluxeFeature:fa")%>
            fa
            <br />
            <% = Html.CheckBox("DeluxeFeature:fb")%>
            fb
            <br />
            <%= Html.CheckBox("DeluxeFeature:fc")%>
            fc
            <br />
            <%= Html.CheckBox("DeluxeFeature:fd")%>
            Stage Construction
            <br />
            <%= Html.CheckBox("DeluxeFeature:fe")%>
            fd
            <br />
            </div>
        </fieldset>

So I want to filter all the HTML elements in my view to get the elements that are under <div id="DeluxeFeatureID"></div>.

Any idea how to do that on controller?

+2  A: 

By the nature of MVC, you can't access any UI elements that are rendered within the View directly from the Controller. All the Controller does is prepare the Model (or ViewData) and then passes it to the View to be rendered.

Chris Pietschmann