Web Custom Control - Tooltip and Rendering within IDE

S

Steve R

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.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using Microsoft.Web.UI.WebControls;
using Common.Controls;

namespace smc.Vehicles
{
/// <summary>
/// Summary description for VehicleSearch.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:VehicleSearch
runat=server></{0}:VehicleSearch>")]
public class VehicleSearch :
System.Web.UI.WebControls.WebControl, INamingContainer
{
SqlConnection _connection;
VehicleSearch.TypeOfSearch typeSearch =
VehicleSearch.TypeOfSearch.PICK;

// 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("Appearance"),
DefaultValue("")]
public VehicleSearch.TypeOfSearch
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.RenderChildren(output);
}

protected override void OnInit
(System.EventArgs e)
{
InitializeControls();
base.OnInit(e);
}

protected override void OnLoad(EventArgs
e)
{
base.OnLoad(e);
registerClientFunctions();
}

public override void DataBind()
{
this.EnsureChildControls();

if (typeSearch !=
VehicleSearch.TypeOfSearch.PICK)
{
thePanel.Visible = false;
theLogoImage.ToolTip
= "The VEHICLE SEARCH control is in " +typeSearch.ToString
()+ " mode." +typeSearchDescription();
}
else
{
thePanel.Visible = true;
theLogoImage.ToolTip
= "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.State !=
ConnectionState.Open)
{
_connection.Open();
}

fillProduct();
fillSequenceNumberType();

_connection.Close();
}
 

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,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top