using System; using System.ComponentModel; using System.Security.Permissions; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Web;namespace WebCalendar { public class WebCalendar:WebControl,INamingContainer { protected Button button = new Button(); // protected HtmlInputText text = new HtmlInputText(); [ Bindable(true), Category("Appearance"), DefaultValue(""), Description("The text to display on the button.") ] public string Text { get { return button.Text; } set { button.Text = value; }
using System.ComponentModel;
using System.Security.Permissions;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web;namespace WebCalendar
{
public class WebCalendar:WebControl,INamingContainer
{ protected Button button = new Button(); // protected HtmlInputText text = new HtmlInputText();
[
Bindable(true),
Category("Appearance"),
DefaultValue(""),
Description("The text to display on the button.")
]
public string Text {
get {
return button.Text;
}
set {
button.Text = value;
}
} protected override void OnPreRender(EventArgs e) {
if (!Page.ClientScript.IsClientScriptIncludeRegistered("WebCalendar")) {
Page.ClientScript.RegisterClientScriptInclude("WebCalendar",Page.ClientScript.GetWebResourceUrl(this.GetType(),"WebCalendar.WebCalendar.js"));
base.OnPreRender(e);
} }
protected override void RenderContents(HtmlTextWriter writer)
{
//writer.AddAttribute("onclick","WebCalendar.yu()");
this.button.Text = "选择日期";
this.button.Height = 20;
this.button.Width = 80;
this.button.OnClientClick = "te.t()";
//this.textbox.Text = "这里是日期";
this.button.RenderControl(writer);
// this.text.RenderControl(writer);
base.RenderContents(writer);
}
}
}
这是我的WebCalendar.cs文件
[assembly: WebResource("WebCalendar.WebCalendar.js","text/javascript")]
这是assembly的添加内容
var te={t: function(){alert("cast down");}
}
这是WebCalendar.js文件