What would be involved in creating a template system in C#
I'm creating a project in C# and I want to be abl开发者_如何转开发e to define "template" files that define the layout that will be produced in an ASP web page. This means from an interface people are able to click certain "areas" and add text, images or a video.
I can only think of using the coordinates to achieve this. Any better ways? Any tips would be good.
have a look at MasterPages in ASP.NET, it's exactly what you are looking for, content regions to be editable in pages associated with the main masterpage.
Are you looking for user-editable templates? Then you want to look at Web Parts. (Web Parts are probably more often associated with SharePoint, but they do exist in ASP.NET without SharePoint.)
I'd pre-define a set of user controls to provide different layout and/or DB access options. I'd style them with CSS and steer clear of XSLT for this particular task.
You could then dynamically load these user controls into the content placeholders defined in master page(s). You don't need to implement Web Parts in order to add content - just create separate admin to add text/images to these areas.
精彩评论