Hi,
I am using WebDataGrid within Infragistics45.Web.v19.2 assembly.
I am unable to move next or previous page through the keyboard tab and I am Unable to Load the records when clicking on Keyboard Enter on specific pagination button.
To say in simple, Pagination Focus, Pagination Enter has to work.
For Example, see the below Image
After performing search, when we click on tab, the focus should go to the links inside the grid. once it is done, focus has to go pagination.
In Pagination, Keyboard enter has to work.
Once the records are loaded on keyboard enter, when user clicks on tab, focus again should move to inside the links of the gird.
Below is the Code of grid and Pagination
Could You please provide the solution on this
Thanks
Adeeb Misba
Hello Adeeb,
In order to be able to tab through the paging buttons and on enter to change the current page, the paging should be templated. This is necessary because the default paging contains span elements instead of buttons. After templating the paging, by pressing “Tab” the focus would move from the “link buttons” to the paging buttons. When “Enter” is pressed the new page is loaded and the focus would be again on the “link buttons”. The pager is templated by adding a panel and then on Page_Load the buttons are created and added to this panel.
int count = ((DataTable)wdg.DataSource).Rows.Count;
int itemsPerPage = wdg.Behaviors.Paging.CurrentPageSize;
int pages = count / itemsPerPage;
Panel field = (Panel)wdg.Behaviors.Paging.PagerTemplateContainerBottom.FindControl("PagerContainer");
for (int i = 0; i < pages; i++) {
Button button = new Button();
button.Text = (i + 1).ToString();
button.ID = i.ToString();
field.Controls.Add(button);
button.Click += new EventHandler(changePage);
}
I have prepared a sample, demonstrating how this could be achieved. Please test it on your side and let me know if you need additional information regarding this matter.
Regards,
Monika Kirkova,
Infragistics
WebDataGridPagingTemplate.zip
Hi Monika,
Thanks for your reply and the info.
I have implemented the same functionality as you mentioned above, but the problem here is event is appending to linkbuttons which are inside the grid but which should not.I think you got confused with my info.
Let me explain you clearly,
I have pagination in the grid, when i do keyboard ENTER, certain page records has to load.
let us consider, I am at 1st page in pagination, when i clicked on tab, it should go to 2nd one, when in 2nd one when i do keyboard enter, records has to load.Once the records are loaded, which i clicked on tab, focus should move to linkbuttons
inside the gird.
PFA for your reference
After investigating this further, I determined the pages of the grid could be iterated using keyboard navigation by pressing for example “Shift”. This could be achieved by binding a method to the keydown event the following way:
<ig:WebDataGrid ID="wdg" runat="server" Height="350px" Width="400px">
<ClientEvents KeyDown="KeyDown" />
. . .
</ig:WebDataGrid>
<script type="text/javascript">
function KeyDown(sender, eventArgs) {
var keyCode = eventArgs.get_browserEvent().keyCode;
if (keyCode == 16) {
var pagingBehavior = sender.get_behaviors().get_paging();
if (pagingBehavior.get_pageIndex() == pagingBehavior.get_pageCount() - 1) {
pagingBehavior.set_pageIndex(0);
} else {
pagingBehavior.set_pageIndex(pagingBehavior.get_pageIndex() + 1);
</script>
Please test it on your side and let me know if you need additional information regarding this matter.