Link to home
Start Free TrialLog in
Avatar of programmerist 1983
programmerist 1983Flag for Türkiye

asked on

what is the difference loading Web user control loading on page?

i try to load some user control on my Default.aspx page selecting dropdown control. i searched some data from net i 've learn 2 methods there is first one :

http://blah.winsmarts.com/2006/05/20/loadcontrol-a-usercontrol--and-pass-in-constructor-parameters.aspx

Second one:

http://www.csharpnedir.com/articles/read/?filter=&author=&cat=aspx&id=689&title=Kullan%C4%B1c%C4%B1%20Web%20Kontrollerini%20Daha%20Etkin%20Kullanmak

Secand one is simple:

protected void Page_Init(object sender, EventArgs e)
{
    AdresBilgisi kontrol1=(AdresBilgisi)LoadControl("AdresBilgisi.ascx");
    AdresBilgisi kontrol2 = (AdresBilgisi)LoadControl("AdresBilgisi2.ascx");

    kontrol1.Ilce = "Ilçe giriniz...";
    kontrol2.PostaKodu = "90000";

    phKontroller.Controls.Add(kontrol1); 
    phKontroller.Controls.Add(kontrol2);
}

Open in new window

which one do you prefer to loadASCx control to page? And Why? please give some detail pros and cons of 2 method(first and second)

ASKER CERTIFIED SOLUTION
Avatar of Kelvin McDaniel
Kelvin McDaniel
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial