Web Custom Control - Tooltip and Rendering within IDE

Discussion in 'ASP .Net' started by Steve R, Oct 30, 2003.

  1. Steve R

    Steve R Guest

    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();
    }
     
    Steve R, Oct 30, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ravi Ambros Wallau
    Replies:
    0
    Views:
    4,091
    Ravi Ambros Wallau
    Jun 1, 2005
  2. Replies:
    0
    Views:
    410
  3. Radu
    Replies:
    1
    Views:
    547
    Bruce Barker
    Jan 8, 2007
  4. Matt Sokol
    Replies:
    2
    Views:
    386
    Theo Tillotson
    Aug 7, 2003
  5. Ravi Ambros Wallau
    Replies:
    0
    Views:
    313
    Ravi Ambros Wallau
    Jun 1, 2005
Loading...

Share This Page