473,756 Members | 9,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom Control not displaying text in Designer

I can create a new custom control (and not change it) and add it to the
toolbox and drag it onto the disign screen and it works just fine,
displaying the text [WebCustomContro l]. However, when I add the following
datepicker control to the toolbox, it just shows a yellow dot and thats it.
What happened to the text???

Earl

using System;

using System.Web.UI;

using System.Web.UI.W ebControls;

using System.Componen tModel;

using System.Text;

namespace CustomControlLi brary

{

[DefaultProperty ("Text"),

ToolboxData("<{ 0}:DatePicker runat=server></{0}:DatePicker> ")]

public class DatePicker : System.Web.UI.W ebControls.WebC ontrol

{

[Bindable(true),

Category("Appea rance"),

DefaultValue("" )]

public string Text

{

get

{

this.EnsureChil dControls();

return ((TextBox)Contr ols[0]).Text;

}

set

{

this.EnsureChil dControls();

((TextBox)Contr ols[0]).Text = value;

}

}

private static string DatePickerJs_St r=DatePickerJs( );

protected override void CreateChildCont rols()

{

Page.RegisterCl ientScriptBlock ("DatePickerJs" ,DatePickerJs_S tr);

TextBox t = new TextBox();

t.Text="TextBox Text";

t.Width=System. Web.UI.WebContr ols.Unit.Pixel( 80);

this.Controls.A dd(t);

this.Controls.A dd(new LiteralControl( "&nbsp<a
href=\"javascri pt:show_calenda r('forms[0]." + t.ClientID + "');\"
onmouseover=\"w indow.status='D ate Picker';return true;\"
onmouseout=\"wi ndow.status=''; return true;\" TABINDEX=\"25\" ><img
src=\"http://" + Page.Request.Se rverVariables["SERVER_NAM E"]+
Page.Request.Ap plicationPath + "/CustomResources/show-calendar.gif\"
width=\"24\" height=\"22\" border=\"0\"></a>"));

}

private static string DatePickerJs()

{

StringBuilder s = new StringBuilder(6 00);

s.Append("<scri pt language=\"Java Script\">\n");

s.Append("<!-- Original: Kedar R. Bhave (so*******@hotm ail.com) -->\n");

s.Append("<!-- Web Site: http://www.softricks.com -->\n");

s.Append("<!-- This script and many more are available free online
at -->\n");

s.Append("<!-- The JavaScript Source!!
http://javascript.internet.com -->\n");

s.Append("var weekend = [0,6];\n");

s.Append("var weekendColor = \"#e0e0e0\";\n" );
Nov 17 '05 #1
0 1226

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
2987
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and provide an open TD with a DIV in it for the content of this formlet. (The DIV is for DHTML to hide and show the content) I've created a web page showing step by step the two problems I'm encountering. This problem is much easier to see than it...
15
6521
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
5
4127
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like to wrap the control in the proper control type - which is also a container. At design time I want to be able to turn this : <my:container> <asp:textbox />
0
9482
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9292
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9901
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9878
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7282
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6551
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5322
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3392
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2694
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.