c# web下自定义控件的问题 web是自己定义了一个控件,编译没有问题,但是运行的时候在page_load后提示未将对象引用设置到对象的实例。哪位能帮忙解释一下问题的所在,在线等待! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 html部分:<%@ Register TagPrefix="customwebcontrols" Namespace="CustomMapControl" Assembly="CustomMapControl" %>//自定义的控件注册<%@ Register TagPrefix="mapinfowebuiwebcontrols" Namespace="MapInfo.Web.UI.WebControls" Assembly="MapInfo.Web" %><%@ Register TagPrefix="mapinfowebuiwebcontrols1" Namespace="MapInfo.Web.UI.WebControls" Assembly="MapInfo.Web, Version=1.0.0.75, Culture=neutral, PublicKeyToken=1687fa7c79f74305" %><%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="CustomMapControl.WebForm1" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML xmlns:v="urn:schemas-microsoft-com:vml"> <HEAD> <title>WebForm1</title> <meta content="Microsoft Visual Studio 7.0" name="GENERATOR"> <meta content="C#" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> <style>v\:* { BEHAVIOR: url(#default#VML)} </style> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <mapinfowebuiwebcontrols:mapcontrol id="MapControl1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 40px" runat="server" WorkspaceFileName="WebForm1MapControl1.mws" Width="656px" Height="376px" BorderStyle="Solid" BorderWidth="1px" MapAlias="Map1" UseDesigntimeWorkspace="True" Format="Gif"></mapinfowebuiwebcontrols:mapcontrol><mapinfowebuiwebcontrols:toolbarcontrol id="ToolbarControl1" style="Z-INDEX: 102; LEFT: 32px; POSITION: absolute; TOP: 8px" runat="server" Width="224px" MapID="MapControl1"> <mapinfowebuiwebcontrols:ZoomInToolControl id="ZoomInToolControl1" runat="server" MapID="MapControl1"></mapinfowebuiwebcontrols:ZoomInToolControl> <mapinfowebuiwebcontrols:ZoomOutToolControl id="ZoomOutToolControl1" runat="server" MapID="MapControl1"></mapinfowebuiwebcontrols:ZoomOutToolControl> <mapinfowebuiwebcontrols:PanToolControl id="PanToolControl1" runat="server" MapID="MapControl1"></mapinfowebuiwebcontrols:PanToolControl> <mapinfowebuiwebcontrols:DistanceToolControl id="DistanceToolControl1" runat="server" MapID="MapControl1" DistanceType="0"></mapinfowebuiwebcontrols:DistanceToolControl> <mapinfowebuiwebcontrols:CenterToolControl id="CenterToolControl1" runat="server" MapID="MapControl1"></mapinfowebuiwebcontrols:CenterToolControl> <customwebcontrols:rectangletoolcontrol id="c21" runat="server" MapID="MapControl1"></customwebcontrols:rectangletoolcontrol>//自定义的控件 </mapinfowebuiwebcontrols:toolbarcontrol><asp:textbox id="TextBox1" style="Z-INDEX: 103; LEFT: 296px; POSITION: absolute; TOP: 8px" runat="server" Width="257px" Height="18px"></asp:textbox><MAPINFOWEBUIWEBCONTROLS1:RECTANGLESELECTIONTOOLCONTROL id="RectangleSelectionToolControl1" style="Z-INDEX: 104; LEFT: 616px; POSITION: absolute; TOP: 16px" runat="server" Width="40" Height="16" MapID="MapControl1"></MAPINFOWEBUIWEBCONTROLS1:RECTANGLESELECTIONTOOLCONTROL></form> </body></HTML>代码部分:public class WebForm1 : System.Web.UI.Page { protected MapInfo.Web.UI.WebControls.MapControl MapControl1; protected MapInfo.Web.UI.WebControls.ZoomInToolControl ZoomInToolControl1; protected MapInfo.Web.UI.WebControls.ZoomOutToolControl ZoomOutToolControl1; protected MapInfo.Web.UI.WebControls.PanToolControl PanToolControl1; protected MapInfo.Web.UI.WebControls.CenterToolControl CenterToolControl1; protected MapInfo.Web.UI.WebControls.DistanceToolControl DistanceToolControl1; protected System.Web.UI.WebControls.TextBox TextBox1; protected CustomMapControl.RectangleToolControl c21; protected MapInfo.Web.UI.WebControls.RectangleSelectionToolControl RectangleSelectionToolControl1; protected MapInfo.Web.UI.WebControls.ToolbarControl ToolbarControl1; private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 this.c21.rectoolhandler +=new CustomMapControl.RectangleToolControl.RectangleToolEventHandler(tf_MapToolAction); }执行完page_load后提示的错误 求大神们帮忙写一个程序,我是超级C#菜鸟 excel转换DATASET 出错,谢谢! 关于reportviewer中动态控制文本框的问题 c#能调用c#创建com 吗 请问,下列问题中VB6的LenB函数,在vb.net和C#中该如何替换。请看VB6代码: 怎样编程实现改变textbox中某个字符的颜色和判断textbox框能容纳的字符个数 用过DHTML Edit control的人看一下 3D视频播放器 求同时控制多个摄像头方法及其代码 C# 数据库取数问题 思归,孟子E章,速马,秋枫。。。,各位大哥请进,我的问题怎么就没人愿意回答一下啊 爱情与推理机
<%@ Register TagPrefix="customwebcontrols" Namespace="CustomMapControl" Assembly="CustomMapControl" %>//自定义的控件注册
<%@ Register TagPrefix="mapinfowebuiwebcontrols" Namespace="MapInfo.Web.UI.WebControls" Assembly="MapInfo.Web" %>
<%@ Register TagPrefix="mapinfowebuiwebcontrols1" Namespace="MapInfo.Web.UI.WebControls" Assembly="MapInfo.Web, Version=1.0.0.75, Culture=neutral, PublicKeyToken=1687fa7c79f74305" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="CustomMapControl.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML xmlns:v="urn:schemas-microsoft-com:vml">
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<style>v\:* {
BEHAVIOR: url(#default#VML)
}
</style>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<mapinfowebuiwebcontrols:mapcontrol id="MapControl1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 40px"
runat="server" WorkspaceFileName="WebForm1MapControl1.mws" Width="656px" Height="376px" BorderStyle="Solid" BorderWidth="1px"
MapAlias="Map1" UseDesigntimeWorkspace="True" Format="Gif"></mapinfowebuiwebcontrols:mapcontrol><mapinfowebuiwebcontrols:toolbarcontrol id="ToolbarControl1" style="Z-INDEX: 102; LEFT: 32px; POSITION: absolute; TOP: 8px"
runat="server" Width="224px" MapID="MapControl1">
<mapinfowebuiwebcontrols:ZoomInToolControl id="ZoomInToolControl1" runat="server" MapID="MapControl1"></mapinfowebuiwebcontrols:ZoomInToolControl>
<mapinfowebuiwebcontrols:ZoomOutToolControl id="ZoomOutToolControl1" runat="server" MapID="MapControl1"></mapinfowebuiwebcontrols:ZoomOutToolControl>
<mapinfowebuiwebcontrols:PanToolControl id="PanToolControl1" runat="server" MapID="MapControl1"></mapinfowebuiwebcontrols:PanToolControl>
<mapinfowebuiwebcontrols:DistanceToolControl id="DistanceToolControl1" runat="server" MapID="MapControl1" DistanceType="0"></mapinfowebuiwebcontrols:DistanceToolControl>
<mapinfowebuiwebcontrols:CenterToolControl id="CenterToolControl1" runat="server" MapID="MapControl1"></mapinfowebuiwebcontrols:CenterToolControl>
<customwebcontrols:rectangletoolcontrol id="c21" runat="server" MapID="MapControl1"></customwebcontrols:rectangletoolcontrol>//自定义的控件
</mapinfowebuiwebcontrols:toolbarcontrol><asp:textbox id="TextBox1" style="Z-INDEX: 103; LEFT: 296px; POSITION: absolute; TOP: 8px" runat="server"
Width="257px" Height="18px"></asp:textbox><MAPINFOWEBUIWEBCONTROLS1:RECTANGLESELECTIONTOOLCONTROL id="RectangleSelectionToolControl1" style="Z-INDEX: 104; LEFT: 616px; POSITION: absolute; TOP: 16px"
runat="server" Width="40" Height="16" MapID="MapControl1"></MAPINFOWEBUIWEBCONTROLS1:RECTANGLESELECTIONTOOLCONTROL></form>
</body>
</HTML>
代码部分:
public class WebForm1 : System.Web.UI.Page
{
protected MapInfo.Web.UI.WebControls.MapControl MapControl1;
protected MapInfo.Web.UI.WebControls.ZoomInToolControl ZoomInToolControl1;
protected MapInfo.Web.UI.WebControls.ZoomOutToolControl ZoomOutToolControl1;
protected MapInfo.Web.UI.WebControls.PanToolControl PanToolControl1;
protected MapInfo.Web.UI.WebControls.CenterToolControl CenterToolControl1;
protected MapInfo.Web.UI.WebControls.DistanceToolControl DistanceToolControl1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected CustomMapControl.RectangleToolControl c21;
protected MapInfo.Web.UI.WebControls.RectangleSelectionToolControl RectangleSelectionToolControl1;
protected MapInfo.Web.UI.WebControls.ToolbarControl ToolbarControl1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
this.c21.rectoolhandler +=new CustomMapControl.RectangleToolControl.RectangleToolEventHandler(tf_MapToolAction);
}
执行完page_load后提示的错误