ASP.NET
  Home arrow ASP.NET arrow Page 4 - Developing a Wonderful ASP.NET TextField C...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Developing a Wonderful ASP.NET TextField Control
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    2007-03-14

    Table of Contents:
  • Developing a Wonderful ASP.NET TextField Control
  • Developing your own flexible Textbox control with new features: identifying requirements
  • Developing your own flexible Textbox control with new features: the skeleton
  • Developing your own flexible Textbox control with new features: coding properties

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Developing a Wonderful ASP.NET TextField Control - Developing your own flexible Textbox control with new features: coding properties


    (Page 4 of 4 )

    The coding for the properties is very simple and easy to understand. The following is the entire code for all the properties mentioned in the skeleton:

     

    <EditorBrowsable(EditorBrowsableState.Always), _
    DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), _
    Bindable(True), Browsable(True), Category("Common")> _
     
    Public Property Text() As String
       
    Get
         
    Return Me.txtControl.Text
       
    End Get
       
    Set(ByVal Value As String)
         
    Me.txtControl.Text = Value
         
    Me.lblControl.Text = Value
       
    End Set
     
    End Property

      <Category("Common")> _
     
    Public Property MaxLength() As Integer
       
    Get
         
    Return Me.txtControl.MaxLength
       
    End Get
       
    Set(ByVal value As Integer)
         
    Me.txtControl.Columns = value
         
    Me.txtControl.MaxLength = value
       
    End Set
     
    End Property

      <Category("Common")> _
     
    Public Property ErrorText() As String
       
    Get
         
    Return m_strErrorText
       
    End Get
       
    Set(ByVal Value As String)
         
    Me.reqfValidator.ErrorMessage = Value & " is required."
         
    m_strErrorText = Value
       
    End Set
     
    End Property

      <Category("Common")> _
     
    Public Property Editable() As Boolean
       
    Get
         
    Return Me.txtControl.Visible
       
    End Get
       
    Set(ByVal Value As Boolean)
         
    If Editable <> Value Then
           
    If Editable Then
             
    lblControl.Text = Me.txtControl.Text
           
    End If
           
    lblControl.Visible = Not Value
           
    txtControl.Visible = Value
           
    reqfValidator.Enabled = Value And Required
           
    spnRequiredIndicator.Visible = Value And Required
         
    End If
       
    End Set
     
    End Property

      <Category("Common")> _
     
    Public Property Required() As Boolean
       
    Get
         
    Return m_blnRequired
       
    End Get
       
    Set(ByVal Value As Boolean)
         
    reqfValidator.Enabled = Editable And Value
         
    spnRequiredIndicator.Visible = Editable And Value
         
    m_blnRequired = Value
       
    End Set
     
    End Property

      <Category("Field Text")> _
     
    Public Property LabelTextValue() As String
       
    Get
         
    Return Me.lblText.Text
       
    End Get
       
    Set(ByVal value As String)
         
    Me.lblText.Text = value
       
    End Set
     
    End Property

      <Category("Field Text")> _
     
    Public Property LabelTextAlign() As System.Web.UI.WebControls.HorizontalAlign
       
    Get
          
    Return pnlText.HorizontalAlign
       
    End Get
       
    Set(ByVal Value As System.Web.UI.WebControls.HorizontalAlign)
         
    pnlText.HorizontalAlign = Value
       
    End Set
     
    End Property

      <Category("Field Text")> _
     
    Public Property LabelTextVisible() As Boolean
       
    Get
         
    Return Me.pnlText.Visible
       
    End Get
       
    Set(ByVal Value As Boolean)
         
    Me.pnlText.Visible = Value
       
    End Set
     
    End Property

      <Category("Field Text")> _
     
    Public Property LabelTextWidth() As System.Web.UI.WebControls.Unit|
       
    Get
         
    Return pnlText.Width
       
    End Get
       
    Set(ByVal Value As System.Web.UI.WebControls.Unit)
         
    pnlText.Width = Value
       
    End Set
     
    End Property

    Developing your own flexible Textbox control with new features: coding properties continued

    The following is the continuation of the previous section for the entire code for all of the properties mentioned in the skeleton:

      Public Property AutoPostBack() As Boolean
       
    Get
         
    Return txtControl.AutoPostBack()
       
    End Get
       
    Set(ByVal Value As Boolean)
         
    txtControl.AutoPostBack = Value
       
    End Set
     
    End Property

      <Category("Appearance")> _
     
    Public Property CssClassTextBoxControl() As String
       
    Get
         
    Return txtControl.CssClass
       
    End Get
       
    Set(ByVal Value As String)
         
    txtControl.CssClass = Value
       
    End Set
     
    End Property

      <Category("Appearance")> _
     
    Public Property CssClassLabelControl() As String
       
    Get
         
    Return Me.lblControl.CssClass
       
    End Get
       
    Set(ByVal value As String)
         
    Me.lblControl.CssClass = value
       
    End Set
     
    End Property

      <Category("Appearance")> _
     
    Public Property CssClassLabelText() As String
       
    Get
         
    Return Me.lblText.CssClass
       
    End Get
       
    Set(ByVal value As String)
         
    Me.lblText.CssClass = value
       
    End Set
     
    End Property

      <Category("Appearance")> _
      
    Public Property Tooltip() As String
       
    Get
         
    Return pnlControl.ToolTip
       
    End Get
       
    Set(ByVal Value As String)
         
    pnlControl.ToolTip = Value
       
    End Set
     
    End Property

      Public Property ValidationGroup() As String
       
    Get
         
    Return Me.txtControl.ValidationGroup
       
    End Get
       
    Set(ByVal value As String)
         
    Me.txtControl.ValidationGroup = value
         
    Me.reqfValidator.ValidationGroup = value
       
    End Set
     
    End Property

      Public Property HintMessage() As String
       
    Get
         
    Return Me.lblHint.Text
       
    End Get
       
    Set(ByVal value As String)
         
    Me.lblHint.Text = value
       
    End Set
     
    End Property

      Public Property HintMessageVisible() As Boolean
       
    Get
         
    Return Me.pnlHint.Visible
       
    End Get
       
    Set(ByVal value As Boolean)
         
    Me.pnlHint.Visible = value
       
    End Set
     
    End Property

    I hope you enjoyed this article. Any suggestions, bugs, errors, enhancements etc. are highly appreciated at http://jagchat.spaces.live.com


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Hello guys! The article fully concentrates on the development of a well-featured...
     

    ASP.NET ARTICLES

    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ
    - Developing a Dice Game Using ASP.NET Futures...
    - Completing an ASP.NET AJAX Server-Centric Ba...
    - Information Management for an ASP.NET AJAX S...
    - Comment and Order Management for an ASP.NET ...
    - Back-end Management Tasks for an ASP.NET AJA...
    - User Information Management for an ASP.NET A...
    - Adding Comments and Search to an ASP.NET AJA...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway