partial class in asp.net 2
-
Hi all, Anyone please tell me whether the whole page is posted back after an event in .net 2005 web pages ( eg: after dropdownlist selected index changed or button click) or is it like an ajax enabled component since code-behind file is now a partial class rather than a full class that inherits from the ASPX page. Please explain. Thanks in advance. Ali
-
Hi all, Anyone please tell me whether the whole page is posted back after an event in .net 2005 web pages ( eg: after dropdownlist selected index changed or button click) or is it like an ajax enabled component since code-behind file is now a partial class rather than a full class that inherits from the ASPX page. Please explain. Thanks in advance. Ali
The partial class is only used to separate your code and the auto generated code into two separate files, it's still compiled into a single class. The postback still works the same, and the aspx page still inherits from the codebehind class (not the other way around).
--- b { font-weight: normal; }
-
The partial class is only used to separate your code and the auto generated code into two separate files, it's still compiled into a single class. The postback still works the same, and the aspx page still inherits from the codebehind class (not the other way around).
--- b { font-weight: normal; }
Thanks guffa, i was a bit confused.
-
The partial class is only used to separate your code and the auto generated code into two separate files, it's still compiled into a single class. The postback still works the same, and the aspx page still inherits from the codebehind class (not the other way around).
--- b { font-weight: normal; }
Hi Guffa
Guffa wrote:
The partial class is only used to separate your code and the auto generated code into two separate files, it's still compiled into a single class.
Which auto generated code you are referring to here.Do you mean vb.net code. I'm also confused about these partial classes. Partial class allows private part of other class to be accessed.thats OK but asp.net page still derives from codebehind so isn't it difficult to digest? Pls elaborate. Thanks -- modified at 0:09 Wednesday 8th November, 2006
Don't Quit
-
Hi Guffa
Guffa wrote:
The partial class is only used to separate your code and the auto generated code into two separate files, it's still compiled into a single class.
Which auto generated code you are referring to here.Do you mean vb.net code. I'm also confused about these partial classes. Partial class allows private part of other class to be accessed.thats OK but asp.net page still derives from codebehind so isn't it difficult to digest? Pls elaborate. Thanks -- modified at 0:09 Wednesday 8th November, 2006
Don't Quit
A partial class is just a class that is split into separate parts.
public partial class A {
... some code
}public partial class A {
... some more code
}is the same as:
public class A {
... some code
... some more code
}The auto generated code is the code that is automatically created to interface with the server controls in the page. For example, if you have a Label named InfoLabel in the page, a reference is created for it:
public protected Label InfoLabel;
--- b { font-weight: normal; }