Click to See Complete Forum and Search --> : Add ToolTip to a DropDownList web control
enigma3440
January 29th, 2006, 09:03 AM
Hi All,
I need to create a ToolTip for a DropDown Control in ASP.Net. I know there's a way to do this. The DropDown control in ASP.Net does not have a ToolTip property, so I need to create one. I don't want to insert JavaScript. I'd prefer to do this in VB.Net code or C# for the ASP.Net page.
I'm aware that the ToolTip control is a part of System.ComponentModel.Component on the VB Windows side, but I can't figure out how to add the ToolTip property to the DropDown control for an ASP.Net DropDown control.
Does anyone know how to do this for an ASP.Net DropDown control?
Thanks
mmetzger
January 29th, 2006, 09:34 AM
I don't think a drop down list can have a tool tip even in straight html, so you're going to need javascript / etc to handle this. To add this, you can add it as an attribute in the c# / vb
ddlControl.Attributes.Add("onmouseover","some code here");
or if you need to do something more elaborate, inherit from the original control and override the render function.
elizas
January 25th, 2010, 04:18 AM
Hi,
I have a tip related to asp.net datapager and i have also added some codes.please check .Hope it will be useful.
ASP.NET pager doesn't provide any direct support for adding tooltip to its different buttons . But there are some work arounds through which you can provide tooltips to ASP.NET data pager.
The structure of a simple data pager is as follows:
<asp:DataPager ID="dpPager" runat="server" PagedControlID="lvCourses" PageSize="5"
OnPreRender="dpPager_PreRender">
<Fields>
<asp:NextPreviousPagerField ButtonCssClass="command " FirstPageText="«" PreviousPageText="‹"
RenderDisabledButtonsAsLabels="true" ShowFirstPageButton="true" ShowPreviousPageButton="true"
ShowLastPageButton="false" ShowNextPageButton="false" />
<asp:NumericPagerField ButtonCount="5" NumericButtonCssClass="command middleButtons" CurrentPageLabelCssClass="current"
NextPreviousButtonCssClass="command" />
<asp:NextPreviousPagerField ButtonCssClass="command " LastPageText="»" NextPageText="›"
RenderDisabledButtonsAsLabels="true" ShowFirstPageButton="false" ShowPreviousPageButton="false"
ShowLastPageButton="true" ShowNextPageButton="true" />
</Fields>
</asp:DataPager>
nelo
January 25th, 2010, 08:30 AM
You have a few options. Ultimately the ASP.NET dropdown will render as an HTML 'Select' element. That element has a 'title' property which will be displayed as a tooltip by good browsers. So you can either set the the 'title' attribute to the text you want to display in the markup (You'll have to ignore the error it gives because of the the fact that 'title' is not a property of ASP.NET DropdownList) or you can hand the PreRender event and use the AddAttributes method to add the title attribute that way.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.