tags:

views:

68

answers:

3

i am migrating a website from asp to asp.net. i have some asp pages that have this in them:

<!--#include file="inc_search_form.asp" -->

what is the translation for doing this in asp.net?

+3  A: 

the best alternative would probably be to create an ASCX file or in other words: a web user control.

Robert Koritnik
A: 

You probably want to put the code into a user control and then use either Html.RenderPartial() or Html.RenderAction() to include that in whatever view you wish.

A good write-up on the pros/cons of each of these methods can be found here: http://devlicio.us/blogs/derik_whittaker/archive/2008/11/24/renderpartial-vs-renderaction.aspx

wgpubs
he said migration to asp.net not asp.net MVC
Robert Koritnik
A: 

Literally it's the same: <!--#include file="inc_search_form.aspx"-->. But you'd better rewrite the inc_search_form to a user control as these other guys suggest.

where would i put this line..?
ooo
At the spot you want it included. For example at the end of your page, before the body close tag to include somekind of footer. Or as your search form probably will be used somewhere at the top, include it there where it should appear.