当前位置:编程学习 > C#/ASP.NET >>

自定义控件 嵌入JS脚本问题 请高手解决!!!!!! 加分!!!!!

代码 如下
[assembly: WebResource("WebControlLibrary1.WebControlLibrary1_JScript1.js", "application/javascript")]
namespace WebControlLibrary1
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")]
    public class WebCustomControl1 : System.Web.UI.WebControls.TextBox
    {
        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public WebCustomControl1()
        {
            this.Load += new EventHandler(WebCustomControl1_Load);
        
        }
 protected override void RenderContents(HtmlTextWriter output)
        {
            base.RenderContents(output);
        }


        void WebCustomControl1_Load(object sender, EventArgs e)
        {
            this.Attributes.Add("onkeypress", "keyup()");
           
            if (!Page.ClientScript.IsClientScriptIncludeRegistered("myscript"))
            {
   Page.ClientScript.RegisterClientScriptInclude("myscript", Page.ClientScript.GetWebResourceUrl(this.GetType(), "WebControlLibrary1.WebControlLibrary1_JScript1.js"));
            
            
            }
            
        }
    }



JS脚本里面只使用了个alert("111"),脚本名称"WebControlLibrary1_JScript1.js" ,生成后在客户端执行事件但找不到方法请问 我是哪里做错了???
--------------------编程问答-------------------- 路径?
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,