473,395 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 [WebCustomControl]. 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.WebControls;

using System.ComponentModel;

using System.Text;

namespace CustomControlLibrary

{

[DefaultProperty("Text"),

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

public class DatePicker : System.Web.UI.WebControls.WebControl

{

[Bindable(true),

Category("Appearance"),

DefaultValue("")]

public string Text

{

get

{

this.EnsureChildControls();

return ((TextBox)Controls[0]).Text;

}

set

{

this.EnsureChildControls();

((TextBox)Controls[0]).Text = value;

}

}

private static string DatePickerJs_Str=DatePickerJs();

protected override void CreateChildControls()

{

Page.RegisterClientScriptBlock("DatePickerJs",Date PickerJs_Str);

TextBox t = new TextBox();

t.Text="TextBox Text";

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

this.Controls.Add(t);

this.Controls.Add(new LiteralControl("&nbsp<a
href=\"javascript:show_calendar('forms[0]." + t.ClientID + "');\"
onmouseover=\"window.status='Date Picker';return true;\"
onmouseout=\"window.status='';return true;\" TABINDEX=\"25\"><img
src=\"http://" + Page.Request.ServerVariables["SERVER_NAME"]+
Page.Request.ApplicationPath + "/CustomResources/show-calendar.gif\"
width=\"24\" height=\"22\" border=\"0\"></a>"));

}

private static string DatePickerJs()

{

StringBuilder s = new StringBuilder(600);

s.Append("<script language=\"JavaScript\">\n");

s.Append("<!-- Original: Kedar R. Bhave (so*******@hotmail.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 1197

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

Similar topics

19
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...
15
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.