ASP.NET Tutorial/Custom Controls/Panel — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 12:00, 26 мая 2010

Creating the templated control"s inner control class (C#)

using System;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebControlLibrary1
{
    public class Message : Panel, INamingContainer
    {
        private string _name;
        private string _text;
        public Message(string name, string text)
        {
            _text = text;
            _name = name;
        }
        public string Name
        {
            get { return _name; }
        }
        public string Text
        {
            get { return _text; }
        }
    }
}


Creating the templated control"s inner control class (VB)

Public Class Message
    Inherits System.Web.UI.WebControls.Panel
    Implements System.Web.UI.INamingContainer
    Private _name As String
    Private _text As String
    Public Sub New(ByVal name As String, ByVal text As String)
        _text = text
        _name = name
    End Sub
    Public ReadOnly Property Name() As String
        Get
            Return _name
        End Get
    End Property
    Public ReadOnly Property Text() As String
        Get
            Return _text
        End Get
    End Property
End Class