wsutton wrote: While working on this I was wondering, how do you declare a codebehind in a transformation?
Unless you are checking the files out to the file system OR using ASPX method of building your website, you don't.
wsutton wrote: Because, if statements and methods really should be put in a codebehind file.
If you want to get technical, yes it's a best practice. Now keep in mind how the Portal Development works. You can build a whole site (10 pages or 10,000 pages) all within the UI without ever touching any physical code behind files by using this method. This is the beauty and ease of working with Kentico.
Transformations are really the connection a developer has between a webpart and code behind without having to touch any physical code behind files. There are many posts on this forum and if you look through the code enough you'll find many times where Kentico actually places lots of code behind worthy syntax in a transformation.
If I were you, I wouldn't get hung up on it. Take advantage of the ease of use. If you find yourself doing something all the time in a transformation, by all means create a custom class and method for it, then call it in your transformation. These files would go in your App_Code directory. Take a
look here for best practice on file/folder structure.
Good luck!
Brenden