I have a bunch of HTML controls created in a design. Now I want to convert them to ASP server controls. Can someone suggest me how to do this? Is it just enough to add runat attribute?
Asked
Active
Viewed 1,760 times
0
-
1What does this question has to do with asp.net mvc tag ? – Shyju Nov 05 '15 at 19:13
-
Server controls aren't compatible with MVC. – recursive Nov 05 '15 at 20:14
1 Answers
1
You just have to add runat="server"
and an id to access it id="whatever"
Example:
<input type="text" value="find" />
<input type="text" runat ="server" id="textId" value="find" />
You can use the id to access it in the codeBehind.
Alternatively, I think you can right click a control in the designer and select run as server control

cfly24
- 1,882
- 3
- 22
- 56
-
Upon adding the runat attribute and then when we try to inspect the element, will the runat attribute show up there? – Akansha Nov 05 '15 at 19:27