Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Missing ID property for a custom control

Reply
Thread Tools

Missing ID property for a custom control

 
 
Raul S
Guest
Posts: n/a
 
      06-27-2004
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(t his)");
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("myTimeControlJavaS criptKey"+ClientID,sb.ToString());
}


Thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
feeding a SQLDataSource embedded in an .ascx user control a custom property assigned to that control ASP .Net 4 07-16-2006 12:20 PM
Custom Attributes (AttributeTargets.Property) and Property Type Zarko Gajic ASP .Net Building Controls 0 04-07-2005 02:20 PM
Custom Control : One custom property to array of controls anon ASP .Net Web Controls 0 01-15-2005 11:32 AM
Keep custom property-value in custom rendered control Rob Joosen ASP .Net Building Controls 0 05-12-2004 11:56 AM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM



Advertisments