Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using visual basic for coding. I drag & dropped a tree view control and edited its nodes. Now when I run my page I get this error->

Control 'TreeView1' of type 'TreeView' must be placed inside a form tag with runat=server.

In the source I have the following entry

asp:TreeView ID="TreeView1" runat="server" Height="155px" Style="z-index: 100; left: 41px; position: absolute; top: 108px" Width="1px" ImageSet="Contacts" NodeIndent="10"

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Just place a form on the page:

so just inside the body tags add:

<body>
<form id="MainForm" runat="server">

... your form controls, including the treeview

</form>
</body>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.