Wednesday, 5 March 2008

Converting HTML to aspx tip

I need to convert some html to aspx. On the page were loads of images and as i moving stuff into master pages it was going to totally scre the directories up.

As you may know with a server control you can use the sqiggle/tilda (~) in a path so the server resolves the actual path for you when it generated the page.

What you can do to save a lot of time is rather than change all the image controls, for example, is just add a runat="server" to the html control and then do a search and replace on the image url to add the ~. This allows the existing alt text etc to be used without having to convert to a server control - which has different naming conventions for the attributes.

No comments: