Missing ID property for a custom control

R

Raul S

Hello,
When i'm using a custom control in my project, i can see that the custom control is missing it's ID in the HTML file. I can see the object name, but not it's ID.
any idea why ?

Here is the custom control code:

public class myTime : Control, INamingContainer
{
public string Value
{
get
{
this.EnsureChildControls();
return ((TextBox)Controls[0]).Text;
}
set
{
EnsureChildControls();
((TextBox)Controls[0]).Text = value.ToString();
}
}
......
other properties
.....

protected override void CreateChildControls()
{
TextBox box = new TextBox();
box.Columns=1;
box.MaxLength=5;
if(System.DateTime.Now.Hour<10)
box.Text="0"+System.DateTime.Now.Hour+":";
else
box.Text=System.DateTime.Now.Hour+":";
box.Text=box.Text+System.DateTime.Now.Minute;
box.Attributes.Add("onkeyup","checkTimeObj(this)");
box.Attributes.Add("onfocusout","checkTimeLength(this)");
Controls.Add(box);
System.IO.StringWriter sw=new System.IO.StringWriter();
System.Text.StringBuilder sb=new System.Text.StringBuilder();
sb.Append("<script language='javascript'>"+sw.NewLine);
......
javascript code here
......
sb.Append("</script>"+sw.NewLine);
Page.RegisterClientScriptBlock("myTimeControlJavaScriptKey"+ClientID,sb.ToString());
}


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top