Tool Tips not working?

Sep 11, 2012 at 4:05 PM

Love the control - has saved me a ton of work.

I'm trying to set a tool tip on the control though - and no matter I put it in the markup or put try to set the value in code - the Tool Tip does not come up when I hover over the control.

Anyone else find this?

Oct 28, 2013 at 3:04 PM
If you still looking for solution I can share with you?
Apr 11, 2014 at 6:41 AM
Edited Apr 11, 2014 at 7:08 AM
Hi, anyone can help in setting the tooltip property of the dropdown chekbox.
Apr 14, 2014 at 8:33 AM
hi, can you pls share the solution..
Apr 14, 2014 at 10:23 AM
Add these to DropDownCheckBox Class
protected override void OnSelectedIndexChanged(System.EventArgs e)
        {
            base.OnSelectedIndexChanged(e);

            this.Texts.CaptionToolTip = DropDownComcoCaptionToolTip(this);
            this.Texts.SelectBoxCaption = DropDownComcoCaptionText(this);

            StringBuilder sb = new StringBuilder();

            for (int j = 0; j < this.Items.Count; j++)
            {
                if (this.Items[j].Selected == true && string.IsNullOrEmpty(sb.ToString()))
                {
                    sb.Append(string.Format("{0}", this.Items[j].Value));
                }
                else
                {
                    sb.Append(string.Format(",{0}", this.Items[j].Value));
                }
            }

            SelectedValuesAsString = sb.ToString();
        }

        private String DropDownComcoCaptionText(TvDropDownCheckBoxes DropDownCombo)
        {
            StringBuilder sb = new StringBuilder();

            foreach (ListItem item in DropDownCombo.Items)
            {
                if (item.Selected)
                {
                    sb.Append(item.Text);
                    sb.Append(",");
                }
            }

            int cationLenghth = 9;
            if (sb.Length > cationLenghth)
            {
                sb.Remove(cationLenghth, sb.Length - cationLenghth);
            }

            if (sb.Length == 0)
            {
                return "Please Select..";
            }
            else
            {
                sb.Remove(sb.ToString().Length - 1, 1);
                sb.Append("..");
                return sb.ToString();
            }
        }

        private String DropDownComcoCaptionToolTip(TvDropDownCheckBoxes DropDownCombo)
        {
            StringBuilder sb = new StringBuilder();

            foreach (ListItem item in DropDownCombo.Items)
            {
                if (item.Selected)
                {
                    sb.Append(item.Text);
                    sb.Append("\n");
                }
            }

            if (sb.ToString().Length > 0)
            {
                sb.Remove(sb.ToString().Length - 1, 1);
            }

            return sb.ToString();
        }

        public string SelectedValuesAsString { get; set; }
Add these to DropDownTexts Class
[Localizable(true)]
        [DefaultValue("")]
        [NotifyParentProperty(true)]
        public string CaptionToolTip
        {
            get
            {
                return ViewState["CaptionToolTip"] as string;
            }
            set
            {
                ViewState["CaptionToolTip"] = value;
            }
        }

 [Localizable(true)]
        [DefaultValue("Select")]
        [NotifyParentProperty(true)]
        public string SelectBoxCaption
        {
            get
            {
                return ViewState["SelectBoxCaption"] as string;
            }
            set
            {
                ViewState["SelectBoxCaption"] = value;
            }
        }

// add below lines to the constructor
public DropDownTexts()
        {
            SelectBoxCaption = "Please Select";
            CaptionToolTip = "";
        }
Finally you can use the methods below in your asp.net web form
private String DropDownComcoCaptionText(TvDropDownCheckBoxes DropDownCombo)
        {
            StringBuilder sb = new StringBuilder();

            foreach (ListItem item in DropDownCombo.Items)
            {
                if (item.Selected)
                {
                    sb.Append(item.Text);
                    sb.Append(",");
                }
            }

            int cationLenghth = 9;
            if (sb.Length > cationLenghth)
            {
                sb.Remove(cationLenghth, sb.Length - cationLenghth);
            }

            if (sb.Length == 0)
            {
                return "Please Select..";
            }
            else
            {
                sb.Remove(sb.ToString().Length - 1, 1);
                sb.Append("..");
                return sb.ToString();
            }
        }

        private String DropDownComcoCaptionToolTip(TvDropDownCheckBoxes DropDownCombo)
        {
            StringBuilder sb = new StringBuilder();

            foreach (ListItem item in DropDownCombo.Items)
            {
                if (item.Selected)
                {
                    sb.Append(item.Text);
                    sb.Append("\n");
                }
            }

            if (sb.ToString().Length > 0)
            {
                sb.Remove(sb.ToString().Length - 1, 1);
            }

            return sb.ToString();
        }
Oct 15, 2014 at 5:01 PM
dogancakmak, Thank you! I have been so frustrated trying to get this working.

There was one additional step I had to take to make this work however.

In the DropDownCheckBoxes Class, add the middle section of code below:
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            //ReseteParentProperties();

            // Add wrapper div
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "inline-block");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "relative");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + selectPstfx);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, !string.IsNullOrEmpty(Style.SelectBoxCssClass) ? Style.SelectBoxCssClass + " " + selectCssClass : selectCssClass);
            if (Style.SelectBoxWidth.Value > 0) writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Style.SelectBoxWidth.ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
           // Add caption
            if (!string.IsNullOrEmpty(Texts.SelectBoxCaption))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, "caption");
                writer.AddAttribute(HtmlTextWriterAttribute.Title, Texts.CaptionToolTip);
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.WriteEncodedText(Texts.SelectBoxCaption);
                writer.RenderEndTag();
            }
        // Add dropdown div markup
        writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + divPstfx);
        writer.AddAttribute(HtmlTextWriterAttribute.Class, !string.IsNullOrEmpty(Style.DropDownBoxCssClass) ? Style.DropDownBoxCssClass + " " + dropDownCssClass : dropDownCssClass);
        writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
        writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
        if (Style.DropDownBoxBoxWidth.Value > 0) writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Style.DropDownBoxBoxWidth.ToString());
        writer.RenderBeginTag(HtmlTextWriterTag.Div);
Thanks again!