You'll
see later that you have to do something to make that happen and here all the
set text box 1.txt equal to state drop-down list one.value thought you take so
will take the value of the drop-down list and place it into the text box Save
it all was run this page will selected value and it works correctly doesn't
work faster than the user control that though once it's on the page ASP.net
doesn't care with the code came from it still works the same way the real
differences this control has a slightly better design time experience.
Because
it appears on the toolbox weakens drag it onto any page and what sincere we
treat it like any other server control how does this control to his job let's
look at the code before go to Florida here I want to look at properties and
methods of this HTML text writer class we might be using is not look at the
code yet was look at properties methods of writer the one that's useful is
added attribute at attribute adds the specified markup and value to the opening
Tagamet element that's useful we had already seen the right method there's the
right attribute method.
This
one just writes the markup attribute value to the output stream were ever we are
within the output is also you see the right begin tag right begin tag begins to
write the output of the beginning of a tag) tag writes the complete and tag out
there's right lie which rights out line obviously there's a default tab string
the default tab string present a single tab character in case what is a tab
into the output of your HTML and there also is the tag right care would outputs
the closing angle bracket so should you want to use this writer to piece
together the beginning portion of an element that some attributes in the
closing right character you would use of this property to do the work so.
Now let's start back and
look and see how this control doesn't strong the first thing it does is in the
public constructor is called the base constructor and tells it what kind of
element were creating this creates the output select tag around all the
contents of this control is nice of the constructor accepts a parameter so you
have to worry about creating the outermost element if step one was creating the
control and calling the base class's constructor then step two involves adding
control attributes this control requires some attributes it needs the base
class attributes like style and position those things are generally provided by
the base web control class we also need a unique ID which is required for data
post back remember were try to keep track of the selected state we have
survival post back sweetie unique ID to do that if auto post back is true we
need an on change attribute which indicates client-side script to run.