Web Parts with a markup file?

I am new to ASP.NET Web Part. I've created a few simple ones using only a class derived from WebPart and overriding the CreateChildControls method, but nothing really essential. My question is, is it possible to have a web part that also uses a separate html / asp.net markup file that will help provide some structure for the web part's output. I used to just create server controls and add them to a collection of controls, but this seems like a silly way to create a non-trivial layout. I can do it? Should I use a custom ascx element or can I work around this step? There are many hello world tutorials on the internet, but none of them goes by overriding CreateChildControls. Thank!

0


source to share


2 answers


Yes there is. Go is here to learn about templated web parts and go here to see all the information it has on web pages. I used this technique back in 2004/2005 and it worked very well.



+1


source


The links in the above answer no longer work, but here is an alternative: http://www.a2zdotnet.com/View.aspx?Id=95



In VS 2010 we also have visual web parts, which I think do pretty much the same trick, but it's wrapped in a project element. I've only seen this in the context of SharePoint, so not sure how it works for ASP.NET projects. Here's an example: http://msdn.microsoft.com/en-us/library/ff597539.aspx

0


source







All Articles