Tool tip

Last post 05-12-2008 2:31 AM by windows_mss. 3 replies.

Sort Posts:

  • Tool tip

    05-09-2008, 9:32 AM
    • Loading...
    • Goodway
    • Joined on 03-16-2004, 10:56 AM
    • Posts 184

    Hello everyone,
    Something weird is happening in my website (asp.net 2.0 website) running it using internet explorer 7.0.
    I am putting tool tip on everyday item of a drop down list using this line of code:

    For Each itm As ListItem In ddlAccountNumber.Items
    itm.Attributes("title") = itm.Text
    Next

     The tool tip is displayed sometimes and not displayed in other times, randomnly.
    Can you help?

  • Re: Tool tip

    05-09-2008, 9:47 AM
    Answer
    • Loading...
    • ramblor
    • Joined on 03-13-2008, 10:03 AM
    • Posts 667
    Are you sure it's random and not just after a postback? ListItems tend not to hang onto their attributes so they need adding again on every postback.
    "Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."
  • Re: Tool tip

    05-11-2008, 11:13 PM
    Answer

    Hi Goodway,

    Your tip is displayed somtimes and not displayed in other times.

    Based on my experience, you may put the code into wrong place.

    You can try the following method.

        protected void DropDownList1_PreRender(object sender, EventArgs e)
        {
            foreach (ListItem itm in DropDownList2.Items)
            {
                itm.Attributes["title"] = itm.Text;

            }

        }


    Let me know if I have misunderstood what you mean.
    Thanks.
    Hope it helps,
    Hua Jun

     

     

    Sincerely,
    Hua Jun Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Re: Tool tip

    05-12-2008, 2:31 AM
    Answer
    • Loading...
    • windows_mss
    • Joined on 01-05-2007, 1:17 AM
    • India
    • Posts 182

    Try This 

    for(int i=0; i<=ddlAccountNumber.items.count-1; i++)
    {
           ddlAccountNumber.Item[i].Attributes.Add("Title", ddlAccountNumber.Item[i].Text)
    }

    Success Be Yours
    NJoy Programming...
    Blogging @ xploredotnet
Page 1 of 1 (4 items)