This repository was archived by the owner on Nov 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
UsingExitStrategyControls
Lodewijk Sioen edited this page Feb 11, 2015
·
2 revisions
ExitStrategy gives you access to your Mvc views on your Webforms pages. There are three controls for this:
- The Partial control: functionally equivalent to Html.Partial
- The DisplayFor control: functionally equivalent to Html.DisplayFor
- The EditorFor Control: functionally equivalent to Html.EditorFor
You can specify the name of the view with the PartialViewName propery:
<mvc:Partial PartialViewName="Header" runat="server"/>
There controls need three sets of data: a Model, a viewname and additional view data. You can provide these using the following methods:
- The model: Using standard Webforms Modelbinding. So either use the
SelectMethod, aDataSourceor theDataSourceproperty. - The View: Can be set with the
TemplateNameproperty on the control. - Additional View Data: By setting the
AdditionalViewDatapropery on the control. You can set this easely with thenewexpression.
For example:
<mvc:Editor ID="ModelBoundEditor" SelectMethod="GetModel" TemplateName="Table" AdditionalViewData='<%$new: {htmlAttributes = new {@class = "form-control"},} %>' runat="server" />