我有.net用戶控件,我將它顯示在對象的asp.net頁面。 如果usercontrol的dll的目標框架是3.5 - 一切正常。 如果我將其更改爲.net 4.0 - activex不可見。.net activex不能在框架4.0工作
usercontrol非常簡單。這只是一個按鈕和一個標籤:
[ComVisible(true)]
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
label1.Text = "0";
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = Convert.ToInt32(label1.Text) + 1 + "";
}
}
這是html代碼:
<object id="myControl2" name="myControl2"
classid="http:ClassLibrary1.dll#ClassLibrary1.UserControl1"
width="300" height="350" />
</asp:Content>
爲什麼它不工作?
是.NET 4安裝在客戶端上嗎? – Yahia 2012-01-02 14:08:53
嗨Yahia。是的,.net 4已經安裝。 – MTs 2012-01-02 14:21:36