SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 219 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

AddAttribute("type","text");
writer.AddAttribute("name",UniqueID);
writer.AddAttribute("value",Text);
base.AddAttributesToRender(writer);
}
Listing 4-2 shows the full code for the TextBox control.
Listing 4-2. The TextBox Control
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;
using System.ComponentModel;
namespace ControlsBook2Lib.Ch04
{
[ToolboxData("<{0}:textbox runat=server>"),
DefaultProperty("Text")]
public class Textbox : WebControl, IPostBackDataHandler
{
public Textbox()
: base(HtmlTextWriterTag.Input)
{
}
public virtual string Text
{
get
138 CHAPTER 4 ?–  T HE WEBCONTROL BASE CLASS AND CONTROL S TYLES
{
object text = ViewState["Text"];
if (text == null)
return string.Empty;
else
return (string)text;
}
set
{
ViewState["Text"] = value;
}
}
public bool LoadPostData(string postDataKey,
NameValueCollection postCollection)
{
string postedValue = postCollection[postDataKey];
if (!Text.Equals(postedValue))
{
Text = postedValue;
return true;
}
else
return false;
}
public void RaisePostDataChangedEvent()
{
OnTextChanged(EventArgs.Empty);
}
private static readonly object TextChangedKey = new object();
public event EventHandler TextChanged
{
add
{
Events.


Pages:
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6