WebCustomControl1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication2
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : WebControl
{
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
public string Text
{
get
{
String s = (String)ViewState["Text"];
return ((s == null) ? "["+this.ID+"]" : s);
}
set
{
if (txtbl != null)
{
this.Text = value;
}
else {
ViewState["Text"] = value;
}
}
}
protected override void RenderContents(HtmlTextWriter output)
{
this.EnsureChildControls(); //하위 컨트롤 찾음CreateChildControls() 실행
output.WriteBeginTag("table");
output.Write(">");
output.WriteBeginTag("tr");
output.Write(">");
output.WriteBeginTag("td");
output.Write(">");
txtbl.RenderControl(output); //하위컨트롤 뿌려줌
output.WriteEndTag("td");
output.WriteEndTag("tr");
output.WriteEndTag("table");
}
private TextBox txtbl;
protected override void CreateChildControls()
{
txtbl = new TextBox();
this.Controls.Add(txtbl);
}
}
}
'ASP.NET AJAX' 카테고리의 다른 글
| [ .NET 테마(Theme) ,스킨(SKIN)] 적용하기 (0) | 2010.01.13 |
|---|---|
| [마스터 페이지, masterpage] 에서 유저컨트롤 안에 접근하기 (0) | 2010.01.13 |
| [Update Panel]업데이트 판넬 에서 파일 업로드 (0) | 2010.01.13 |
| HTTP 모듈 만들기 및 구성 , URL 맵핑 (0) | 2010.01.13 |
| [엑셀출력] Export GridView to Excel (0) | 2010.01.13 |
| AJAX TOOLKITS 달력 작동 제대로 안될때 (0) | 2010.01.13 |
| 금액표시 , 문자열 , 콤마 표시 (0) | 2010.01.13 |
| 자바스크립트로 닷넷 프레임워크 설치여부 확인 (0) | 2010.01.12 |
| [listView] 리스트 아이템 저장하기 (0) | 2010.01.11 |
| 데이터바인딩 방법 (0) | 2010.01.11 |