Solved

Populate ListBox and tooltip of Listbox

Posted on 2006-06-23
8
793 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
Comment Utility
Use
"alt"  HTML tag

regards
pradeep
0
 

Author Comment

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

Expert Comment

by:Collindsouza
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Expert Comment

by:naisnet
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
Thanks mate...

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

Cheers,
Collin

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

16 Experts available now in Live!

Get 1:1 Help Now