Solved

Populate ListBox and tooltip of Listbox

Posted on 2006-06-23
8
798 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Validation for a field in asp.net 3 31
Need help for captcha 2 42
Data Analysis 7 59
EF5: Update Model from Database not working 3 83
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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