Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: What is better? LoadControl programmatically OR use mycontrol.visible=False|True ???


Message #1 by "Andreas Klemt" <aklemt68@h...> on Wed, 23 Oct 2002 19:57:22
I'd say number 2 is better.

That way the control is already loaded so performance will be better than
loading
it at the click of a button as and when you need it.

P

-----Original Message-----
From: Andreas Klemt [mailto:aklemt68@h...]
Sent: 23 October 2002 20:57
To: ASPX_Professional
Subject: [aspx_professional] What is better? LoadControl
programmatically OR use mycontrol.visible=False|True ???


Hello,

I have a UserControl which should be only shown when a Button is clicked.

What is the best (professional, performance etc) way ?

1) After Butten Click I load my Control programmatically like:
    Page.LoadControl("my.ascx")

2) <%@ Register %> my UserControl and work with
  in my Page_Load with  myControl.Visible = false
 and when Butten is clicked then myControl.Visible = true

Is there any performance difference?

Thanks in advance,
Andreas
---

ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442

ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450

These books are a complete reference to the ASP.NET namespaces 
for developers who are already familiar with using ASP.NET. 
There is no trivial introductory material or useless .NET 
hype and the presentation of the namespaces, in an easy-to use 
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes, 
giving you those real-world tips that the documentation doesn't 
offer, and demonstrating complex techniques with simple 
examples.  

---

  Return to Index