Solved

Custom web control

Posted on 2008-06-23
11
1,353 Views
Last Modified: 2011-09-20
Hi,
I am giving a presentation on custom web control. I prepared whatever is there in MSDN but not able to find some good examples. Please send me some links of examples.
let me know what all should I know to develop custom web controls. When should I develop Composite controls.
Thx
0
Comment
Question by:vmaddalis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
11 Comments
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 21845524
Have you done the walkthough?  If so, what is it missing that you would expect to find in "a good example"?
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 21845569
As for the difference between controls types, see the
"What are the basic differences between user controls and custom controls?"
section in
http://support.microsoft.com/kb/893667
0
 

Author Comment

by:vmaddalis
ID: 21845587
I have done a walkthrough and two three examples from MSDN. But I wanted a real time scenario where we need to create a web custom control and the code for it.

For example ASP.NET fileupload control doesn't hold the file name in the viewstate. probably we can create a custom control which can hold the file name. I want real time examples which say this custom web control is beneficial and provides other facilities to built in web server control.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 21845672
The example you picked with the fileupload is a very unlike one!

The reason the file name is not kept in the viewstate is that this is an item that MUST be entered by the user for security reasons - file upload is DIRECTLY supported by the browser, and very restricted ...... or you would be free to just suck ANY file off the client computer.

I think you mean "real life" rather than "real time".
0
 

Author Comment

by:vmaddalis
ID: 21846796
whether it is real time or real life I want some examples where I can show to people of creating enhanced web server controls. I am new custom controls so I cannot think of use case of creating one but I want to see some examples. let me know if you know any.
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 21847943
Very common and simple case, Making a control that packages a textbox with a label.  I was programming in VB when I did this, but it is very similar to C#
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
 
<Designer("JensControls.LabelledTextDesigner, LabelledText"), _
DefaultProperty("label"), ToolboxData("<{0}:LabelledText runat=server></{0}:LabelledText>")> Public Class LabelledText
    Inherits JensControl
    Implements INamingContainer
    Implements IJensControl
 
    Private WithEvents tb As TextBox
    Private td As TableCell
    Private tabMain As Table
    Private valRegexp As RegularExpressionValidator
 
    Public Overrides Property text() As String
        Get
            Return tb.Text
        End Get
        Set(ByVal Value As String)
            tb.Text = Value
        End Set
    End Property
 
    Public Property textWidth() As String
        Get
            Return tb.Style("width")
        End Get
        Set(ByVal Value As String)
            tb.Style("width") = Value
        End Set
    End Property
 
 
    Public Property isCapsonly() As Boolean
        Get
            If ViewState("isCapsonly") Is Nothing Then
                Return True
            End If
            Return ViewState("isCapsonly")
        End Get
        Set(ByVal Value As Boolean)
            ViewState("isCapsonly") = Value
        End Set
    End Property
 
    Public Overrides Property isEnabled() As Boolean
        Get
            Return Not tb.ReadOnly
        End Get
        Set(ByVal Value As Boolean)
            tb.ReadOnly = Not Value
        End Set
    End Property
 
    Public Property regexValidatorExpr() As String
        Get
            Return valRegexp.ValidationExpression
        End Get
 
        Set(ByVal Value As String)
            valRegexp.ValidationExpression = Value
            valRegexp.Enabled = Value <> ""
        End Set
    End Property
 
    Public Property regexValidatorMsg() As String
        Get
            Return valRegexp.ErrorMessage
        End Get
        Set(ByVal Value As String)
            valRegexp.ErrorMessage = Value
        End Set
    End Property
 
    Public Overrides Property width() As String
        Get
            Return tabMain.Style("width")
        End Get
        Set(ByVal Value As String)
            tabMain.Style("width") = Value
        End Set
    End Property
 
    Public Property maxTextLength() As Int32
        Get
            Return tb.MaxLength
        End Get
        Set(ByVal Value As Int32)
            tb.MaxLength = Value
        End Set
    End Property
 
 
    Public Overrides Property isAutopostback() As Boolean
        Get
            Return tb.AutoPostBack
        End Get
        Set(ByVal Value As Boolean)
            tb.AutoPostBack = Value
        End Set
    End Property
 
    Public Event TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
 
 
    Public Sub HandleTextChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles tb.TextChanged
        RaiseEvent TextChanged(Me, e)
    End Sub
 
    Public Overrides ReadOnly Property Controls() As ControlCollection
        Get
            Return MyBase.Controls
        End Get
    End Property
 
    Sub New()
        tabMain = New Table
        tabMain.Style("display") = "inline"
        tb = New TextBox
        tb.CssClass = "My_StandardTextBox"
        valRegexp = New RegularExpressionValidator
        valRegexp.Style("text-align") = "left"
        valRegexp.Enabled = False
        valRegexp.Display = ValidatorDisplay.Dynamic
        Dim tr As New TableRow
        td = New TableCell
        tabMain.Rows.Add(tr)
        td.Controls.Add(tb)
        tr.Cells.Add(labelHeader)
        tr.Cells.Add(td)
        td.Style("text-align") = "left"
        If textWidth <> "" Then
            td.Style("width") = textWidth
        Else
            If tb.Style("width") IsNot Nothing Then
                td.Style("width") = tb.Style("width")
            End If
        End If
 
        tr = New TableRow
        Dim tdVal As New TableCell
        tr.Cells.Add(tdVal)
        tdVal.ColumnSpan = 2
        tdVal.Style("text-align") = "left"
        tdVal.Controls.Add(requiredValidator)
        tabMain.Rows.Add(tr)
        tr = New TableRow
        tdVal = New TableCell
        tr.Cells.Add(tdVal)
        tdVal.ColumnSpan = 2
        tdVal.Style("text-align") = "left"
        tdVal.Controls.Add(valRegexp)
        tabMain.Rows.Add(tr)
 
        Controls.Add(tabMain)
 
    End Sub
 
    Protected Overrides Sub CreateChildControls()
        MyBase.CreateChildControls()
        lbStar.Visible = requiredValidator.Enabled
        If isCapsonly Then
            tb.Style("text-transform") = "uppercase"
        End If
        tb.ID = Me.ClientID & "_tb"
        If valRegexp.ErrorMessage = "" Then
            valRegexp.ErrorMessage = "not valid format for " & lb.Text
        End If
        If requiredValidator.ErrorMessage = "" Then
            requiredValidator.ErrorMessage = lb.Text & " is required"
        End If
        requiredValidator.ControlToValidate = tb.ID
        valRegexp.ControlToValidate = tb.ID
    End Sub
 
    Public Sub ValidateEmail()
        regexValidatorExpr = "^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
        regexValidatorMsg = "must be valid email address; example: JBFiederer@WEGMANS.COM"
        isCapsonly = False
    End Sub
 
    Public Sub ValidateURI()
        regexValidatorExpr = "^(((http(s?))|(ftp))\:\/\/)?[a-zA-Z0-9\-\.]+\.(com|edu|gov|mil|net|org|biz|info|name|museum|[a-zA-Z][a-zA-Z])(\:[0-9]+)*(\/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$"
        regexValidatorMsg = "must be valid URL; example: http://www.google.com"
        isCapsonly = False
    End Sub
 
    Public Sub ValidateNaturalNumber()
        regexValidatorExpr = "\d*"
        regexValidatorMsg = "amount must be a natural number"
    End Sub
 
    Public Sub ValidateDecimal()
        regexValidatorExpr = "-{0,1}(\d*)(\.\d*){0,1}"
        regexValidatorMsg = "amount must be a decimal number"
    End Sub
 
    Public Sub ValidateDollarCents()
        regexValidatorExpr = "(\d*)(\.\d\d){0,1}"
        regexValidatorMsg = "amount must be whole number or have two decimal digits"
    End Sub
 
    Public Sub ValidatePhone()
        regexValidatorExpr = "(\d{3}-){0,1}\d{3}-\d{4}"
        regexValidatorMsg = "phone number must match ###-#### or ###-###-####"
    End Sub
 
    Public Sub ValidatePhoneWithArea()
        regexValidatorExpr = "\d{3}-\d{3}-\d{4}"
        regexValidatorMsg = "phone number must match ###-###-####"
    End Sub
 
    ' must match US ZIP code
    Public Sub ValidateZIP()
        regexValidatorExpr = "\d{5}(-\d{4}){0,1}"
        regexValidatorMsg = "ZIP code must match ##### or #####-#### (where # is a digit 0-9)"
    End Sub
 
    ' must match US ZIP code or Canadian Postal Code
    Public Sub ValidatePostal()
        regexValidatorExpr = "\d{5}(-\d{4}){0,1}|[a-zA-Z][0-9][a-zA-Z]\s*[0-9][a-zA-Z][0-9]"
        regexValidatorMsg = "ZIP code must match #####, #####-#### or x#x #x# (where # is a digit 0-9 and X is a letter)"
    End Sub
 
End Class
------------------------------------------------
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
 
 
 
Public Interface IJensControl
    Inherits System.Web.UI.ITextControl
    Property label() As String
    Property originalText() As String
    Property protectFromReset() As Boolean
    Property protectFromShow() As Boolean
    ReadOnly Property hasChanged() As Boolean
End Interface
 
Public MustInherit Class JensControl
    Inherits Control
    Implements INamingContainer, IJensControl
 
    Protected lb As Label
    Protected lbStar As Label
    Protected labelHeader As TableHeaderCell
    Protected requiredValidator As RequiredFieldValidator
    Protected parentControl As Control
 
    Public MustOverride Property isAutopostback() As Boolean
    Public MustOverride Property isEnabled() As Boolean
    Public MustOverride Property width() As String
    Public MustOverride Property text() As String Implements IJensControl.Text
 
    Public Property label() As String Implements IJensControl.label
        Get
            Return lb.Text
        End Get
        Set(ByVal Value As String)
            lb.Text = Value
        End Set
    End Property
 
 
    Public Property labelAlign() As String
        Get
            Return labelHeader.Style("text-align")
        End Get
        Set(ByVal Value As String)
            labelHeader.Style("text-align") = Value
        End Set
    End Property
 
    Public Property labelWidth() As String
        Get
            Return labelHeader.Style("width")
        End Get
        Set(ByVal Value As String)
            labelHeader.Style("width") = Value
        End Set
    End Property
 
    Public Property originalText() As String Implements IJensControl.originalText
        Get
            If ViewState("originalText") Is Nothing Then
                Return ""
            End If
            Return ViewState("originalText")
        End Get
        Set(ByVal Value As String)
            ViewState("originalText") = Value
            text = Value
        End Set
    End Property
 
 
    Public ReadOnly Property hasChanged() As Boolean Implements IJensControl.hasChanged
        Get
            Return text <> originalText
        End Get
    End Property
 
    Public Property isRequired() As Boolean
        Get
            Return requiredValidator.Enabled
        End Get
        Set(ByVal value As Boolean)
            requiredValidator.Enabled = value
        End Set
    End Property
 
    Public Property requiredValidatorMsg() As String
        Get
            Return requiredValidator.ErrorMessage
        End Get
        Set(ByVal Value As String)
            requiredValidator.ErrorMessage = Value
        End Set
    End Property
 
    Public Property labelBgColor() As String
        Get
            Return lb.BackColor.ToString
        End Get
        Set(ByVal Value As String)
            lb.BackColor = System.Drawing.Color.FromName(Value)
        End Set
    End Property
 
    Public Shared Sub SetOriginal(ByVal c As Control)
        If c.GetType Is GetType(LabelledText) Then
            Dim lt As LabelledText = CType(c, LabelledText)
            lt.originalText = lt.text
        Else
            For Each subControl As Control In c.Controls
                SetOriginal(subControl)
            Next
        End If
    End Sub
 
    Enum showtype
        showOnlyChanged
        boldChanged
        showAll
    End Enum
 
    Enum showformat
        html
        text
    End Enum
 
    Public Property protectFromShow() As Boolean Implements IJensControl.protectFromShow
        Get
            If ViewState("protectFromShow") Is Nothing Then
                Return False
            Else
                Return ViewState("protectFromShow")
            End If
        End Get
        Set(ByVal value As Boolean)
            ViewState("protectFromShow") = value
        End Set
    End Property
 
 
    Public Shared Sub Show(ByVal c As Control, ByVal sb As System.Text.StringBuilder, _
        Optional ByVal level As showtype = showtype.showAll, _
        Optional ByVal format As showformat = showformat.text)
        Dim eol As String = Chr(10)
        Dim boldOn As String = ""
        Dim boldOff As String = ""
        If format = showformat.html Then
            eol = "<br/>"
            boldOn = "<b>"
            boldOff = "</b>"
        End If
        Dim isJens As Type = c.GetType.GetInterface("IJensControl")
        If isJens Is Nothing Then
            If c.GetType Is GetType(ShowLabel) Then
                sb.Append(boldOn & CType(c, ShowLabel).Text & boldOff & eol)
            End If
            For Each subControl As Control In c.Controls
                Show(subControl, sb, level, format)
            Next
        Else
            If c.Visible Then
                Dim ss As IJensControl = c
                Select Case level
                    Case showtype.showOnlyChanged
                        If ss.hasChanged Then
                            sb.Append(ss.label & ": " & eol & ss.Text & eol)
                        End If
                    Case showtype.showAll
                        sb.Append(ss.label & ": " & eol & ss.Text & eol)
                    Case showtype.boldChanged
                        If ss.hasChanged Then
                            sb.Append(boldOn & ss.label & ": " & eol & ss.Text & boldOff & eol)
                        Else
                            sb.Append(ss.label & ": " & eol & ss.Text & eol)
                        End If
                End Select
            End If
        End If
    End Sub
 
    Public Property protectFromReset() As Boolean Implements IJensControl.protectFromReset
        Get
            If ViewState("protectFromReset") Is Nothing Then
                Return False
            Else
                Return ViewState("protectFromReset")
            End If
        End Get
        Set(ByVal value As Boolean)
            ViewState("protectFromReset") = value
        End Set
    End Property
 
    Public Shared Sub Reset(ByVal c As Control)
        Dim controlType As Type = c.GetType.GetInterface("IJensControl")
        If controlType Is Nothing Then
            Select Case c.GetType.Name.ToLower
                Case "textbox"
                    CType(c, TextBox).Text = ""
                Case "htmltextarea"
                    CType(c, HtmlControls.HtmlTextArea).Value = ""
            End Select
        End If
        If controlType IsNot Nothing Then
            Dim mainControl As IJensControl = c
            If Not mainControl.protectFromReset Then
                mainControl.Text = ""
                mainControl.originalText = ""
            End If
        Else
            For Each subControl As Control In c.Controls
                Reset(subControl)
            Next
        End If
    End Sub
 
    Sub New()
        requiredValidator = New RequiredFieldValidator
        requiredValidator.Style("text-align") = "left"
        requiredValidator.Enabled = False
        requiredValidator.Display = ValidatorDisplay.Dynamic
        labelHeader = New TableHeaderCell
        lb = New Label
        lb.CssClass = "My_StandardLabel"
        lb.Style("text-align") = "right"
        lbStar = New Label
        lbStar.Text = "*"
        lbStar.ForeColor = System.Drawing.Color.Red
        labelHeader.Controls.Add(lbStar)
        labelHeader.Controls.Add(lb)
        labelHeader.Style("text-align") = "right"
        If labelWidth <> "" Then
            labelHeader.Style("width") = labelWidth
        End If
 
    End Sub
 
End Class

Open in new window

0
 

Author Comment

by:vmaddalis
ID: 21864735
Jens - Do you have any C# examples of web server controls.
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 21878943
Not yet - I mean, I could google up something, but it wouldn't be real-life.

Converting the real-life  VB example I had available will take a little time....I actually started on it.
0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 500 total points
ID: 21971772
OK, converted enough to compile and run, if not to implement all the functionality - you can do that as an exercise (LabelledText.cs)  :-)

Probably you don't see many real-life cases posted because the fake ones are easier to understand, making the real-life ones pretty useless unless they happen to be what you want anyway.....

//-------------------- JensControl.cs ------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
 
namespace jenscontrols
{
    interface IJensControl : ITextControl
    {
        string label { get; set;}
        string originalText { get; set;}
        Boolean protectFromReset { get; set;}
        Boolean protectFromShow { get; set;}
        Boolean hasChanged { get; }
        Boolean isAutopostback { get; set;}
        Boolean isEnabled { get; set;}
        String width { get; set;}
    }
 
    public abstract class JensControl : Control, INamingContainer, IJensControl
    {
        protected Label lb;
        protected Label lbStar;
        protected TableHeaderCell labelHeader;
        protected RequiredFieldValidator requiredValidator;
        protected Control parentControl;
 
 
        public JensControl()
        {
            requiredValidator = new RequiredFieldValidator();
            requiredValidator.Style["text-align"] = "left";
            requiredValidator.Enabled = false;
            requiredValidator.Display = ValidatorDisplay.Dynamic;
            labelHeader = new TableHeaderCell();
            lb = new Label();
            lb.CssClass = "My_StandardLabel";
            lb.Style["text-align"] = "right";
            lbStar = new Label();
            lbStar.Text = "*";
            lbStar.ForeColor = System.Drawing.Color.Red;
            labelHeader.Controls.Add(lbStar);
            labelHeader.Controls.Add(lb);
            labelHeader.Style["text-align"] = "right";
            if (labelWidth != "")
            {
                labelHeader.Style["width"] = labelWidth;
            }
        }
 
        #region IJensControl Members
 
        public string label
        {
            get
            {
                return lb.Text;
            }
            set
            {
                lb.Text = value;
            }
        }
 
        public string originalText
        {
            get
            {
                if (ViewState["originalText"] == null)
                {
                    return "";
                }
                else
                {
                    return (string)ViewState["originalText"];
                }
            }
            set
            {
                ViewState["originalText"] = Text = value;
            }
        }
 
        public string labelAlign
        {
            get
            {
                return labelHeader.Style["text-align"];
            }
            set
            {
                labelHeader.Style["text-align"] = value;
            }
        }
 
        public string labelWidth
        {
            get
            {
                return labelHeader.Style["width"];
            }
            set
            {
                labelHeader.Style["width"] = value;
            }
        }
 
        public bool isRequired
        {
            get
            {
                return requiredValidator.Enabled;
            }
            set
            {
                requiredValidator.Enabled = value;
            }
        }
 
        public string requiredValidatorMsg
        {
            get
            {
                return requiredValidator.ErrorMessage;
            }
            set
            {
                requiredValidator.ErrorMessage = value;
            }
        }
 
        public string labelBgColor
        {
            get
            {
                return lb.BackColor.ToString();
            }
            set
            {
                lb.BackColor = System.Drawing.Color.FromName(value);
            }
        }
 
        public bool protectFromReset
        {
            get
            {
                if (ViewState["protectFromReset"] == null)
                {
                    return false;
                }
                else
                {
                    return (bool)ViewState["protectFromReset"];
                }
            }
            set
            {
                ViewState["protectFromReset"] = value;
            }
        }
 
        public bool protectFromShow
        {
            get
            {
                if (ViewState["protectFromShow"] == null)
                {
                    return false;
                }
                else
                {
                    return (bool)ViewState["protectFromShow"];
                }
            }
            set
            {
                ViewState["protectFromShow"] = value;
            }
        }
 
        public bool hasChanged
        {
            get { return Text != originalText; }
        }
 
 
        #endregion
 
        public abstract string Text { get;set;}
        public abstract string width { get;set;}
        public abstract bool isEnabled { get;set;}
        public abstract bool isAutopostback { get;set;}
 
        public static void SetOriginal(Control c)
        {
            if (c is LabelledText)
            {
                LabelledText lt = (LabelledText)c;
                lt.originalText = lt.Text;
            }
            else
            {
                foreach (Control subcontrol in c.Controls)
                {
                    SetOriginal(subcontrol);
                }
            }
        }
 
        public static void Show(Control c, StringBuilder sb, showtype level)
        {
            Show(c, sb, level, showformat.text);
        }
 
        public static void Show(Control c, StringBuilder sb)
        {
            Show(c, sb, showtype.showAll, showformat.text);
        }
 
        public static void Show(Control c, StringBuilder sb, showtype level, showformat format)
        {
            string eol = Environment.NewLine;
            string boldOn = "";
            string boldOff = "";
            if (format == showformat.html)
            {
                eol = "<br/>";
                boldOn = "<b>";
                boldOff = "</b>";
            }
            Type isJens = c.GetType().GetInterface("IJensControl");
            if (isJens == null)
            {
                if (c.GetType() == typeof(ShowLabel))
                {
                    sb.Append(boldOn);
                    sb.Append(((ShowLabel)c).Text);
                    sb.Append(boldOff);
                    sb.Append(eol);
                }
                foreach (Control subControl in c.Controls)
                {
                    Show(subControl, sb, level, format);
                }
            }
            else
            {
                if (c.Visible)
                {
                    IJensControl ss = c as IJensControl;
                    switch (level)
                    {
                        case showtype.showOnlyChanged:
                            if (ss.hasChanged)
                            {
                                sb.Append(ss.label + ": " + eol + ss.Text + eol);
                            }
                            break;
                        case showtype.showAll:
                            sb.Append(ss.label + ": " + eol + ss.Text + eol);
                            break;
                        case showtype.boldChanged:
                            if (ss.hasChanged)
                            {
                                sb.Append(boldOn + ss.label + ": " + eol + ss.Text + boldOff + eol);
                            }
                            else
                            {
                                sb.Append(ss.label + ": " + eol + ss.Text + eol);
                            }
                            break;
                    }
                }
            }
        }
 
        public static void Reset(Control c)
        {
            Type controlType = c.GetType().GetInterface("IJensControl");
            if (controlType == null)
            {
                switch (c.GetType().Name.ToLower())
                {
                    case "textbox":
                        (c as TextBox).Text = "";
                        break;
                    case "htmltextarea":
                        (c as HtmlTextArea).Value = "";
                        break;
                }
            }
            if (controlType != null)
            {
                IJensControl mainControl = c as IJensControl;
                if (!mainControl.protectFromReset)
                {
                    mainControl.Text = "";
                    mainControl.originalText = "";
                }
            }
            else
            {
                foreach (Control subControl in c.Controls)
                {
                    Reset(subControl);
                }
            }
        }
 
        public enum showformat { html, text };
        public enum showtype { showOnlyChanged, boldChanged, showAll };
    }
}
 
//-------------------- ShowLabel.cs ------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace jenscontrols
{
    [Designer("JensControls.ShowLabelDesigner, ShowLabel"), 
        DefaultProperty("label"), ToolboxData("<{0}:ShowLabel runat=server></{0}:ShowLabel>")]
    public class ShowLabel : Label, INamingContainer
    {
    }
}
 
//-------------------- LabelledText.cs ------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace jenscontrols
{
    [Designer("JensControls.LabelledTextDesigner, LabelledText"), 
        DefaultProperty("label"), 
    ToolboxData("<{0}:LabelledText runat=server></{0}:LabelledText>")]
    public class LabelledText : JensControl
    {
        private TextBox tb;
        private TableCell td;
        private Table tabMain;
        private RegularExpressionValidator valRegexp;
 
        public override string Text
        {
            get { return tb.Text; }
            set { tb.Text = value; }
        }
 
        public override string width
        {
            get { return tb.Style["width"]; }
            set { tb.Style["width"] = value; }
        }
 
        public override Boolean isEnabled
        {
            get { return tb.ReadOnly; }
            set { tb.ReadOnly = value; }
        }
 
        public override Boolean isAutopostback
        {
            get { return tb.AutoPostBack; }
            set { tb.AutoPostBack = value; }
        }
 
    }
}

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question