Adding Dynamic OnClick Event and Tooltip to ListView
I have used and been using OnClick events and tooltips over the GridView control so many times in my 2.0 based projects. I believe it is a good practice for the usability of the presentation layer. I thought it may also be a good feature to add them to the ListView control as well.
• I will be using the same ListView scenario and the Access database that I used before in this post.
As I use OnRowDataBound method in GridView for the purpose, I decided to use the OnItemDataBound method in ListView. After assigning this method’s value to “CountryListBound”, here is code part:
whereas trIT controls are:
For the Tooltip object, I designed its CSS class as:
After application file is debugged, browser shows the following screens:
• When cursor is mouse over’ed
• When the item (actually row) with ID of 10 is OnClick’ed:
Sample source code can be downloaded via here.