Solved

Populate ListBox and tooltip of Listbox

Posted on 2006-06-23
8
794 Views
Last Modified: 2012-05-05
Hi,
I have a ListBox list on my web page. One of the column's data is pulled and populated in it successfully. There is one more column in the database table that i would like to display in the tooltip of ListBox.

for eg.
My database table tblProduct has 2 columns Name and description.
I have populated Name in the ListBox and I would like display description in the tool tip when user keeps his mouse pointer over one of the product names, so description should appear as a tool tip.

Please ask more questions if any clarification is required.

Thanks in advance.
0
Comment
Question by:Junior_Developer
8 Comments
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 16968826
Use
"alt"  HTML tag

regards
pradeep
0
 

Author Comment

by:Junior_Developer
ID: 16969013
Can you please let me know how do i use it. i am a newbie  :)
0
 
LVL 5

Expert Comment

by:Collindsouza
ID: 16970261
Hi junior Developer,
Do you have to use a list box control ?? Because Tool tip ios an atriblute of the "alt"  HTML tag which is not part of the list items in a listbox control..

Can you not use a repeater control.. since its data driven.. and essentially does the same thing?

In the code behind Use the following

Bind the Repeater control to a datasource
Repeater1.datasource = // in your case its tblProduct
Repeater1.databind()

in the .aspx file use the repeater control as follows...

If you choose to use a repeater control.. than you can achieve a tool tip by doing the following

<asp:Repeater ID="Repeater1" runat="server">
 
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" ToolTip='<%#DataBinder.Eval(Container.DataItem, "description")%>'
          Text='<%#DataBinder.Eval(Container.DataItem, "Name ")%>' runat="server" />
</ItemTemplate>

</asp:Repeater>

0
 

Author Comment

by:Junior_Developer
ID: 16970407
I cannot change it now. my whole project is over except for this little thing.
Let me ask you this, some how i have to show users the description of the data listed in the listbox.

My suggestion:
I would like users to click the link button and new aspx page opens up with Productname and ProductDescription.
I already have a stored procedure that gets me Productname and ProductDescription.

I think this makes it much simpler. once user sees the description in our new page he should be able to close this window

Thanks a ton
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Expert Comment

by:naisnet
ID: 16970699
Here's another solution if the size of the dropdownlist isn't an issue:

Write your SQL query to pull data in this manner:

SELECT product_index AS productID, product_name + ' (' + product_description + ')' AS productNAME FROM xxxxx........

This will create a custom "field" called productname where you can list both name and description.

0
 

Author Comment

by:Junior_Developer
ID: 16971059
Naisnet,
this is great but this is what i did and is working great but need some more help from you.
i have created another aspx page with datagrid on it. this data grid now has all the information that i want to display.
now i would just like to click on the link button that i have created to show up this new page.
i want it to be open in a new window so that user once read it can close and be back on the same page.

Thanks i appreciate all your help in this... waiting for your response
0
 
LVL 5

Accepted Solution

by:
Collindsouza earned 500 total points
ID: 16971724

this is much simpler.. You need to do something similar to what i suggested earlier with Repeater control.. Only this time you need to do it with the datagrid Control... in that case.. add a ASP link button to the data grid and doo the following in the aspx page in the datagrid section of the code

<asp:LinkButton ID="BtnHyperLink" onclick="<%# "Javascript:var w=window.open('ANOTHERPAGE.aspx?ID=" + DataBinder.Eval(Container.DataItem, "DATA") + "','','width=950,height=600,resizable=yes');" %>" />

NOTE:-
ANOTHERPAGE.aspx is the New page that you want to display in a popup
ID is the ID you need to pass as a query string to the new page wherein you can then retrieve the record based on this ID
DATA is what you pass to the ID as a Query string
0
 
LVL 5

Expert Comment

by:Collindsouza
ID: 16973151
Thanks mate...

As long as your problem is resolved... I'm happy..

Cheers,
Collin

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now