|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using AjaxControlToolkit;
namespace CustomControls
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:DateBoxGrid runat=server></{0}:DateBoxGrid>")]
[ValidationProperty("Text")]
public class DateBoxGrid : WebControl, INamingContainer
{
public DateBox _dateBox = new TextBox();
public ImageButton _imageButton = new ImageButton();
public CalendarExtender _calendarExtender = new CalendarExtender();
public HtmlGenericControl _div = new HtmlGenericControl("div");
[Bindable(true)]
[Category("Behaviour")]
[DefaultValue("")]
[Localizable(true)]
public event EventHandler TextChanged
{
add
{
this._dateBox.TextChanged += value;
}
remove
{
this._dateBox.TextChanged -= value;
}
}
[Bindable(true)]
[Category("Behaviour")]
[DefaultValue("")]
[Localizable(true)]
public string Text
{
get { return this._dateBox.Text; }
set { this._dateBox.Text = value; }
}
protected override void CreateChildControls()
{
this._dateBox.ID = this.ID + "DateBox";
this._dateBox.CssClass = "GridRoundedDateBox";
this._imageButton.ID = this.ID + "ImageButton";
this._imageButton.ImageUrl = Page.ClientScript.GetWebResourceUrl(typeof(DateBoxGrid), "CustomControls.Images.calendar.gif");
this._imageButton.CssClass = "PaddingTop";
this._calendarExtender.ID = this.ID + "CalendarExtender";
this._calendarExtender.PopupButtonID = _imageButton.ID;
this._calendarExtender.TargetControlID = _dateBox.ID;
this._calendarExtender.Format = "dd.MM.yyyy";
this._div.Attributes.Add("class", "GridRoundedCornersDiv PaddingTop GridBackground91");
this._div.Controls.Add(_dateBox);
this.Controls.Add(_div);
this.Controls.Add(_imageButton);
this.Controls.Add(_calendarExtender);
}
/// <summary>
/// Include the embedded resource.
/// </summary>
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
ScriptManager sm = ScriptManager.GetCurrent(Page);
if (!sm.IsInAsyncPostBack)
{
//Add strylesheet.
HtmlLink cssLink = new HtmlLink();
string cssUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "CustomControls.CustomControls.css");
cssLink.Href = cssUrl;
cssLink.Attributes.Add("rel", "stylesheet");
cssLink.Attributes.Add("type", "text/css");
this.Page.Header.Controls.Add(cssLink);
}
}
protected override void RenderContents(HtmlTextWriter output)
{
this._div.RenderControl(output);
output.Write(" ");
this._imageButton.RenderControl(output);
this._calendarExtender.RenderControl(output);
}
}
}
|
Advertisement
| Hall of Fame |