I've built a composite web custom control with a lot of
child controls. I assigned ToolTip values to some of
these controls. The ToolTip pop-ups were working fine
until I monkeyed with the order I am rendering the
controls. I had to do this so that the control rendered
properly when a developer drags it from the toolbox onto
the page. Any ideas?
Below is the meat of the code from my user control. The
remainder is private methods.
*************** *************** *************** *******
using System;
using System.Data;
using System.Data.Sql Client;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.H tmlControls;
using System.Componen tModel;
using Microsoft.Web.U I.WebControls;
using Common.Controls ;
namespace smc.Vehicles
{
/// <summary>
/// Summary description for VehicleSearch.
/// </summary>
[DefaultProperty ("Text"),
ToolboxData("<{ 0}:VehicleSearc h
runat=server></{0}:VehicleSear ch>")]
public class VehicleSearch :
System.Web.UI.W ebControls.WebC ontrol, INamingContaine r
{
SqlConnection _connection;
VehicleSearch.T ypeOfSearch typeSearch =
VehicleSearch.T ypeOfSearch.PIC K;
// child controls
Panel theDiv = new Panel();
Panel thePanel = new Panel();
Image theLogoImage = new Image();
DropDownList ddlbProduct = new
DropDownList();
TextBox tbBodyStart = new TextBox();
TextBox tbBodyEnd = new TextBox();
DropDownList ddlbSeqType = new
DropDownList();
TextBox tbSeqStart = new TextBox();
TextBox tbSeqEnd = new TextBox();
TextBox tbEIM1 = new TextBox();
TextBox tbEIM2 = new TextBox();
TextBox tbEIM3 = new TextBox();
TextBox tbEIM4 = new TextBox();
TextBox tbEIM5 = new TextBox();
TextBox tbEIM6 = new TextBox();
TextBox tbEIM7 = new TextBox();
TextBox tbEIM8 = new TextBox();
TextBox tbEIM9 = new TextBox();
TextBox tbEIM10 = new TextBox();
TextBox tbEIM11 = new TextBox();
TextBox tbEIM12 = new TextBox();
TextBox tbEIM13 = new TextBox();
TextBox tbEIM14 = new TextBox();
TextBox tbEIM15 = new TextBox();
TextBox tbEIM16 = new TextBox();
TextBox tbEIM17 = new TextBox();
TextBox tbEIM18 = new TextBox();
DropDownList ddlbProduct2 = new
DropDownList();
TextBox tbSSDFrom = new TextBox();
TextBox tbSSDTo = new TextBox();
Common.Controls .nnaDateControl dcFrom =
new Common.Controls .nnaDateControl ();
Common.Controls .nnaDateControl dcTo = new
Common.Controls .nnaDateControl ();
[Bindable(false) ,
Category("Data" ),
DefaultValue("" )]
public SqlConnection Connection
{
get
{
return _connection;
}
set
{
_connection = value;
}
}
[Bindable(false) ,
Category("Appea rance"),
DefaultValue("" )]
public VehicleSearch.T ypeOfSearch
SearchType
{
get
{
return typeSearch;
}
set
{
typeSearch = value;
}
}
public enum TypeOfSearch
{
PICK,
BUILDSEQUENCE,
STATUS,
COLOR
}
/// <summary>
/// Render this control to the output
parameter specified.
/// </summary>
/// <param name="output"> The HTML writer
to write out to </param>
protected override void Render
(HtmlTextWriter output)
{
this.RenderChil dren(output);
}
protected override void OnInit
(System.EventAr gs e)
{
InitializeContr ols();
base.OnInit(e);
}
protected override void OnLoad(EventArg s
e)
{
base.OnLoad(e);
registerClientF unctions();
}
public override void DataBind()
{
this.EnsureChil dControls();
if (typeSearch !=
VehicleSearch.T ypeOfSearch.PIC K)
{
thePanel.Visibl e = false;
theLogoImage.To olTip
= "The VEHICLE SEARCH control is in " +typeSearch.ToS tring
()+ " mode." +typeSearchDesc ription();
}
else
{
thePanel.Visibl e = true;
theLogoImage.To olTip
= "The VEHICLE SEARCH control is in PICK mode. You can
choose the desired output type by changing the selection
in the SEARCH TYPE radio buttons.";
}
if (_connection.St ate !=
ConnectionState .Open)
{
_connection.Ope n();
}
fillProduct();
fillSequenceNum berType();
_connection.Clo se();
}