I've created a asp:TreeView control in a ASP.NET MVC Partial View. The view renders fine without the control. With the control I get the follow exception:
Control 'MainContent_TreeView1' of type 'TreeView' must be placed inside a form tag with runat=server
Since this is not a WebForms project, I don't see why I'd need a form. What am I missing?
Basically, I don't believe you can add webforms controls to MVC pages.
You need to create a separate aspx page (a webforms page inside your MVC project) to use server controls.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.