ASP.NET Tutorial/Custom Controls/Panel — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 18:30, 26 мая 2010
Creating the templated control"s inner control class (C#)
<source lang="csharp">
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; } } }
}</source>
Creating the templated control"s inner control class (VB)
<source lang="csharp">
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</source>