webForm中调用WinForm控件问题,亟待解决,谢
我做了个winForm控件,在html文件中调用没问题;方法如下:
<html>
<body>
<p>Simple Control
<br>
<br>
</body>
<object id="simpleControl1"
classid="http:SimpleControl.dll#Microsoft.Samples.WinForms.Cs.SimpleControl.SimpleControl"
height="300" width="300" VIEWASTEXT>
<param name="Text" value="Simple Control">
</object>
</html>
但在aspx中出错,应如何调用???
问题点数:100、回复次数:6Top
1 楼qiuji(忆秋季)回复于 2003-10-03 18:21:01 得分 90
我试过了,没有问题的,你把代码写少了。
完整代码如下:
<html>
<script language="JScript">
function ChangeText() {
simpleControl1.Text = text1.value;
}
</script>
<body>
<p>Simple Control
<br>
<br>
</body>
<object id="simpleControl1"
classid="http:SimpleControl.dll#Microsoft.Samples.WinForms.Cs.SimpleControl.SimpleControl"
height="300" width="300" VIEWASTEXT>
<param name="Text" value="Simple Control">
</object>
<br>
<br>
<input type="text" id="text1">
<input type="button" value="Change Text" onclick="ChangeText()">
</html>
全文请见:
http://chs.gotdotnet.com/quickstart/winforms/doc/WinFormsIeSourcing.aspxTop
2 楼whatme168(江湖浪子)回复于 2003-10-03 18:21:15 得分 10
不清楚..帮你upTop
3 楼qiuji(忆秋季)回复于 2003-10-03 18:28:46 得分 0
另外,还要注意:
你的那个simpleControl控件必须安装到全局程序集缓存中或者与包含它的 Web 页位于同一虚拟目录中。
你可以把那个SimpleControl.dll和SimpleControl.pdb复制到当前的虚拟目录下就可以了。Top
4 楼qiuji(忆秋季)回复于 2003-10-03 18:37:43 得分 0
在aspx中,你可以这样(注意添加的位置,位置错了会出问题的):
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="test.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
<script language="JScript">
function ChangeText() {
simpleControl1.Text = text1.value;
}
</script>
</head>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<p>Simple Control
<br>
<br>
</form>
</body>
<object id="simpleControl1"
classid="http:SimpleControl.dll#Microsoft.Samples.WinForms.Cs.SimpleControl.SimpleControl"
height="300" width="300" VIEWASTEXT>
<param name="Text" value="Simple Control">
</object>
<br>
<br>
<input type="text" id="text1">
<input type="button" value="Change Text" onclick="ChangeText()">
</html>
Top
5 楼bbildb(下里巴人)回复于 2003-10-03 19:38:05 得分 0
在aspx中调用还是有问题Top
6 楼bbildb(下里巴人)回复于 2003-10-03 19:47:49 得分 0
错误:
行 26:
行 27: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
行 28: public class Global_asax : WebControl.Global {
行 29:
行 30: private static bool __initialized = false;
Top




