Wrox Programmer Forums
|
BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Server Control and Component Development by Dr. Shahram Khosravi; ISBN: 9780471793502
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 27th, 2008, 05:37 AM
Authorized User
 
Join Date: Oct 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Nicholsen
Default Page 104

You must initialize your child controls before you add them to the Controls collection of your custom
control, because if you initialize them after you add them to the Controls collection, these initialized
property values will be saved to view state. This will unnecessarily increase the size of your custom control’s
view state.
I need more detail explanation about the difference between :
paymentMethodList = new DropDownList();
paymentMethodList.Width = Unit.Percentage(100);
paymentMethodList.Items.Add(new ListItem(“Visa”, “Visa”));
paymentMethodList.Items.Add(new ListItem(“MasterCard”, “MasterCard”));
paymentMethodList.ID = “PaymentMethodList”;
container.Controls.Add(paymentMethodList);

with

DropDownList paymentMethodList;
container.Controls.Add(paymentMethodList);
paymentMethodList = new DropDownList();
paymentMethodList.Width = Unit.Percentage(100);
paymentMethodList.Items.Add(new ListItem(“Visa”, “Visa”));
paymentMethodList.Items.Add(new ListItem(“MasterCard”, “MasterCard”));
paymentMethodList.ID = “PaymentMethodList”;

Can Everybody explain more detail about why before initialization and after initialization can affect ViewState size!

Thank You Very Much






Similar Threads
Thread Thread Starter Forum Replies Last Post
access C#.Net page as action of calssic ASP page mansharma_s ASP.NET 1.x and 2.0 Application Design 6 January 7th, 2008 10:58 AM
confuse page 104 kencheung BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 August 16th, 2004 03:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.