谁能帮我把这段.net2.0下写的转换成.net1.1的写法?
这段代码是参考MSDN上的例子写的,但是其中CompositeControl在2.0上才支持的,在1.0下必须实现 INamingContainer接口。
源代码
//=====================================================
// Register.cs
using System;
using System.ComponentModel;
using System.Drawing;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Net.Sockets;
namespace WCLibrary
{
[
AspNetHostingPermission(SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal),
DefaultEvent( "Submit "),
DefaultProperty( "ButtonText "),
ToolboxData( " <{0}:Register runat=\ "server\ "> </{0}:Register> "),
]
public class Register : CompositeControl
{
private Button submitButton;
private TextBox nameTextBox;
private Label nameLabel;
private RequiredFieldValidator nameValidator;
private static readonly object EventSubmitKey =
new object();
// The following properties are delegated to
// child controls.
[
Bindable(true),
Category( "Appearance "),
DefaultValue( " "),
Description( "The text to display on the button. ")
]
public string ButtonText
{
get
{
EnsureChildControls();
return submitButton.Text;
}
set
{
EnsureChildControls();
submitButton.Text = value;
}
}
[
Bindable(true),
Category( "Default "),
DefaultValue( " "),
Description( "The user name. ")
]
public string Name
{
get
{
EnsureChildControls();
return nameTextBox.Text;
}
set
{
EnsureChildControls();
nameTextBox.Text = value;
}
}
[
Bindable(true),
Category( "Appearance "),
DefaultValue( " "),
Description(
"Error message for the name validator. ")
]
public string NameErrorMessage
{
get
{
EnsureChildControls();
return nameValidator.ErrorMessage;
}
set
{
EnsureChildControls();
nameValidator.ErrorMessage = value;
nameValidator.ToolTip = value;
}
}
[
Bindable(true),
Category( "Appearance "),
DefaultValue( " "),
Description( "The text for the name label. ")
]
public string NameLabelText
{
get
{
EnsureChildControls();
return nameLabel.Text;
}
set
{
EnsureChildControls();
nameLabel.Text = value;
}
}
// The Submit event.
[
Category( "Action "),
Description( "Raised when the user clicks the button. ")
]
public event EventHandler Submit
{
add
{
Events.AddHandler(EventSubmitKey, value);
}
remove
{
Events.RemoveHandler(EventSubmitKey, value);
}
}
[解决办法]
直接转换工程
[解决办法]
C# 的??
[解决办法]
有自动转换向导