Monday, March 26, 2012

Panel - Dyamic Controls

Hi,

I am just studying for MCAD and I came across this piece of code:
---------------
LiteralControl lcExpenseCaption = new LiteralControl();
lcExpenseCaption.Text = String.Format("Travel Expense for Day - {0} ",
i);
TextBox txtExpense = new TextBox();
txtExpense.ID = String.Format("Expense{0}", i);
HtmlControl lcBreak = new HtmlGenericControl("br");
---------------

What I don't know is how to remember or recognize that a break is an
object of the HtmlControl, HtmlGenericControl, the textbox is simply an
object of Textbox class, a literal belongs to a class named
LiteralControl?

I mean these lines essentially create a label, a textbox and a break.
And the way they accomplish these three things are three completely
different methods. Isn't there a general way these things are ordered
and named? Aren't the classes in some form of hierarchy so I don't have
to remember the differences between creating a textbox, a label, a
break, etc. etc.> Isn't there a general way these things are ordered
> and named?

There sure is.

> Aren't the classes in some form of hierarchy so I don't have
> to remember the differences between creating a textbox, a label, a
> break, etc. etc.

Yes they are.

I would recommend downloading, installing, and studying the .Net Framework
SDK:

http://www.microsoft.com/downloads/...&displaylang=en

A certtificate isn't worth much unless you study for it. Even then, the
certificate isn't worth anything; the studying is.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

<asadikhan@.hotmail.com> wrote in message
news:1109088729.008514.95510@.z14g2000cwz.googlegro ups.com...
> Hi,
> I am just studying for MCAD and I came across this piece of code:
> ---------------
> LiteralControl lcExpenseCaption = new LiteralControl();
> lcExpenseCaption.Text = String.Format("Travel Expense for Day - {0} ",
> i);
> TextBox txtExpense = new TextBox();
> txtExpense.ID = String.Format("Expense{0}", i);
> HtmlControl lcBreak = new HtmlGenericControl("br");
> ---------------
> What I don't know is how to remember or recognize that a break is an
> object of the HtmlControl, HtmlGenericControl, the textbox is simply an
> object of Textbox class, a literal belongs to a class named
> LiteralControl?
> I mean these lines essentially create a label, a textbox and a break.
> And the way they accomplish these three things are three completely
> different methods. Isn't there a general way these things are ordered
> and named? Aren't the classes in some form of hierarchy so I don't have
> to remember the differences between creating a textbox, a label, a
> break, etc. etc.

0 comments:

Post a Comment