Search code examples
htmlasp.net.netaspx-user-control

convert HTML controls to ASP server controls


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?


Solution

  • 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