做了一个控件:一个文本框旁边加了一个放大镜查询,其中使用到的图片是使用内嵌资源编译的. 在控件的源代码中是使用如下方法引用图片的:
Page.ClientScript.GetWebResourceUrl();控件中的一段源代码如下:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;[assembly: TagPrefix("XXX.XXX.Controls", "XXX")]
[assembly: System.Web.UI.WebResource("XXX.XXX.Controls.res.search.gif", "image/gif")]
[assembly: System.Web.UI.WebResource("XXX.XXX.Controls.res.search2.gif", "image/gif")]
[assembly: System.Web.UI.WebResource("XXX.XXX.Controls.res.icon_note.gif", "image/gif")]
[assembly: System.Web.UI.WebResource("XXX.XXX.Controls.res.public.js", "text/javascript")]
[assembly: System.Web.UI.WebResource("XXX.XXX.Controls.res.DeptSelecter.js", "text/javascript")]
[assembly: System.Web.UI.WebResource("XXX.XXX.Controls.res.close.gif", "text/javascript")]
.
.
.imgSearch.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "XXX.XXX.Controls.res.search2.gif");
            imgSearch.Attributes.Add("hideimg", this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "XXX.XXX.Controls.res.icon_note.gif"));
            imgSearch.Attributes.Add("closeimg", this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "XXX.XXX.Controls.res.close.gif"));
            ImgSearchControl();
            imgSearch.ID = this.ID + "_imgSearch";
            Controls.Add(imgSearch);
上面的控件在ASPX页面中拖入就可以正常使用.
但是,如果使用母版页(MasterContentPage.Master).新建一个此母版的内容页.在这个内容页中拖入此控件,控件就不能正常使用了.点击文本框旁边的查询图标就会报下面的错.Webpage error detailsUser Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; TCO_20100115155355; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152)
Timestamp: Fri, 15 Jan 2010 09:56:38 UTC
Message: Object required
Line: 34
Char: 5
Code: 0
URI: http://localhost/WMS/WebResource.axd?d=kHXmbz9s8xTCrIbcRhi3-397FdrNWnGZM1DYw3MYVwaVuCss2zj9rVlv3lVhan0lqFtehIbRXBMbxT51wn_yxg2&t=633990096280000000
望兄弟姐妹们帮个忙,看看是怎么回事? 是不是使用内嵌资源的控件不能在内容页中使用. 谢谢!!!

解决方案 »

  1.   

    看不懂..------------------------------------------------------------------------------ 
    Blog: http://blog.csdn.net/tianlesoftware 
    网上资源: http://tianlesoftware.download.csdn.net 
    相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx 
    Q Q 群:62697716 
      

  2.   

    不是变版主了吗
    有权限可以把帖子移动ORACLE外的版块不
      

  3.   

    重写init事件. 看一下画母版的页面加载顺序就知道了