Short answer:
you cannot.
Strictly speaking, as you did not show fully qualified names in your code sample, so what I say is my guess, but this is unlikely something else. It looks like UI code, most likely using
System.Windows.Forms
. If has nothing to do with ASP.NET. Even though your could formally write it in the ASP.NET application, how the application host can run it? On the server side? Who will see it? :-)
The problem is not that you don't know how ASP.NET works. It looks like you have no idea how a Web application works, otherwise you would not ask such question.
You can do only one thing: totally redesing and rewrite all your UI in ASP.NET. Are you interested? Start from here:
http://www.asp.net/get-started[
^].
—SA