Solved

Populate ListBox and tooltip of Listbox

Posted on 2006-06-23
8
795 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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
 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

785 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