When you click a control that generates a postback, you are generating a page refresh. This results in a fresh re-render of the page from the top down, which naturally starts at the top. If you use the AJAX extensions you can make the calendar control refresh inside of an update panel which will eliminate the whole page refresh and result in much faster response from the calendar control.
Regarding the "partial class" issue. This is a little misleading. In the sense of actual objects/classes being created, there is no such thing as a "partial" class. It has to do with the way that code can be compiled. In the past, you had to define everything that makes up a code entity (i.e., structure, class, etc) in a single file. This became a burden for situations where one may want some part of the code to be auto generated by some tool. Partial classes now permit us to define multiple parts of the same class in different code blocks. I have intentionally avoided using the work "file" here because it's not technically about files. You could have a single file that contained something like this:
Code:
public partial class Foo{
// some stuf here ...
}
public partial class Foo{
// some more stuff here
}
While this is technically possible it doesn't make much sense as you could just put everything in the same file.
However, this makes a lot of sense when you want to break up the "concerns" of a class. In .NET development using Visual Studio the IDE creates a partial class file that contains all the stuff the designer takes care of (i.e. definition [and layout] for forms, both windows and ASP.NET). All the code that we manage is in another file. This keeps "our" file clean. In .NET 3.5 LinqToSQL a big file is generated with many partial classes for all the SQL database objects that are wired up to the data context. Defining them as partial in this file that VS manages allows us to add to the objects in our own files and not loose that work when the "VS file" is regenerated.
The partial class feature is very powerful, but you have to be careful where you use it. If you start breaking up your classes into too many files you can get into maintenance confusion. More importantly, feeling that you need to break up the file may indicate a bigger problem with class design. A refactoring may be in order to clean up the class(es).
-Peter
compiledthoughts.com