Improving performance of SharePoint Web part s
-
Hi, This question is regarding the best practice to be followed while developing web parts. In developing web parts, the CreateChildControls method can be programmed in 2 ways, Create all the required controls inside this method, set their properties and call 'this.Controls.Add(xxxx)' for each control created. or Create the controls to be rendered in web part as a web user control i.e., .ascx file and deploy this control in the 12 hive's Control Templates folder. In the 'CreateChildControl' method, load this web user control and call 'this.Controls.Add(xxxx)'. When developing a web part with complex controls or rather huge number of controls in it, which one of the above is best in terms of performance and why? Thanks Arut
-
Hi, This question is regarding the best practice to be followed while developing web parts. In developing web parts, the CreateChildControls method can be programmed in 2 ways, Create all the required controls inside this method, set their properties and call 'this.Controls.Add(xxxx)' for each control created. or Create the controls to be rendered in web part as a web user control i.e., .ascx file and deploy this control in the 12 hive's Control Templates folder. In the 'CreateChildControl' method, load this web user control and call 'this.Controls.Add(xxxx)'. When developing a web part with complex controls or rather huge number of controls in it, which one of the above is best in terms of performance and why? Thanks Arut
Neither is better or worse in terms of performance. Performance is more related to how it was the coded and how it functions. In SharePoint 2010 a visual webpart, an ascx, can't be deployed as a sandboxed solution (there are ways, but ignore them for this discussion) so you would be limited to the CreateChild method.
I know the language. I've read a book. - _Madmatt
-
Hi, This question is regarding the best practice to be followed while developing web parts. In developing web parts, the CreateChildControls method can be programmed in 2 ways, Create all the required controls inside this method, set their properties and call 'this.Controls.Add(xxxx)' for each control created. or Create the controls to be rendered in web part as a web user control i.e., .ascx file and deploy this control in the 12 hive's Control Templates folder. In the 'CreateChildControl' method, load this web user control and call 'this.Controls.Add(xxxx)'. When developing a web part with complex controls or rather huge number of controls in it, which one of the above is best in terms of performance and why? Thanks Arut
I don't know wether it has an impact on performance, but I've read in several best practice documents, that whenever possible the CreateChildControl should only be used for the final polish. Unlike ASP.NET Web controls, they are defined and rendered with templates. http://msdn.microsoft.com/en-us/library/bb687949(v=office.12).aspx[^] Check the "Using Web Controls" part.
-
I don't know wether it has an impact on performance, but I've read in several best practice documents, that whenever possible the CreateChildControl should only be used for the final polish. Unlike ASP.NET Web controls, they are defined and rendered with templates. http://msdn.microsoft.com/en-us/library/bb687949(v=office.12).aspx[^] Check the "Using Web Controls" part.
Coded webparts and visual webparts are two separate animals. The point of a visual webpart is to not needing to use the CreateChildControls method yourself, it is handled in the background. You can't give a visual webpart a final polish and switch to using this method. You may as well have started there in the first place.
I know the language. I've read a book. - _Madmatt
-
Coded webparts and visual webparts are two separate animals. The point of a visual webpart is to not needing to use the CreateChildControls method yourself, it is handled in the background. You can't give a visual webpart a final polish and switch to using this method. You may as well have started there in the first place.
I know the language. I've read a book. - _Madmatt
I completely agree with you. If you're able to make a visual webpart, you should do it.
-
I completely agree with you. If you're able to make a visual webpart, you should do it.
peac3maker wrote:
If you're able to make a visual webpart, you should do it.
I didn't say that. You should choose the technology and techniques that fit the situation. Whether that is a visual web part or a more traditional one.
I know the language. I've read a book. - _Madmatt
-
peac3maker wrote:
If you're able to make a visual webpart, you should do it.
I didn't say that. You should choose the technology and techniques that fit the situation. Whether that is a visual web part or a more traditional one.
I know the language. I've read a book. - _Madmatt
Thanks for the response.