Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / ASP.NET / ASP.NET4

AjaxControlToolkit Accordeon has Bad Influence on PagerTemplate of Gridview

3.00/5 (1 vote)
8 Jun 2023CPOL1 min read 6K  
AjaxControlToolkit Accordeon's bad influence on Gridview PagerTemplate
The spinner goes wierd when using a TextBox with TextMode=Number in PagerTemplate.

Introduction

When loading large volumes of data in a GridView, it comes in very handy to only load the page you need to display and calculate the number of pages that are in the full collection. In that case, you write a PagerTemplate in your GridViewdefinition. In that definition, I wanted to use a TextBox with a Number defined as TextMode. It gives a spinner in your TextBox. If your GridView is placed in an Accordean control of AjaxControlToolkit, you will experience that when clicking the spinner, the spinner keeps on counting as long as the mouse stays on it (no button press needed after the click).

CSS is the way out for this problem.

Background

My users complained they couldn't get easily to the desired pagenumber when using the TextBox in the GridView. 'It kept counting', was the complaint.

Using the Code

I found out only when having the Gridview in the Accordeon control that this behaviour would occur. A solution to this problem is not having the spinning buttons when using a TextBox in the PagerTemplate of the GridView in the Accordeon template. This can be easily set-up in your CSS. All my TextBox controls set up for TextMode=Number do not have the spinner anymore.

CSS
input[type=number]::-webkit-inner-spin-button {
            -webkit-appearance: none;
            display: none;
        }

History

  • 8th June, 2023: v0.1: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)