如果使用ASP.NET MVC 5单击上一个和下一个按钮,如何显示db中文本框中的上一个和下一个记录 [英] How to dispaly previous and next records in textboxes from db if click on the previous and next buttons using ASP.NET MVC 5

查看:84
本文介绍了如果使用ASP.NET MVC 5单击上一个和下一个按钮,如何显示db中文本框中的上一个和下一个记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

页面中有3个按钮。 prevoius按钮和下一个按钮,刷新按钮。当我点击下一个按钮意味着它应该显示来自db的下一个记录,而前一个按钮意味着它应该显示以前的记录,刷新意味着重新加载当前页面。这是我的要求



我尝试了什么:



给我解决方案当我单击上一个和下一个按钮时,如何显示db中的上一个和下一个记录

3 buttons is there in page. prevoius button and next button , refresh button . when i click on next button means it should display next records from db and previous button means it should display previous records and refresh means reload the current page . this is my requirement

What I have tried:

give me solution how to display previous and next records from db when i click on previous and next buttons

推荐答案

在应用程序端维护分页。

步骤。



St 1:首先选择总记录数。

st 2:创建页面对象具有页码,页数并使用记录计数填充它们。

St 3:从DB中获取第一页并显示它以查看和初始化页面的计数器并在视图中保存页面对象。 br />
St 4:递增,递减和重置页面对象,并在下一个,上一个和重置事件中从db获取记录。
Maintain paging at your application side.
Steps to follow .

St 1: First select total record count initially .
st 2: Create a page object having page number,page count and fill them using record count.
St 3: Fetch first page from DB and show it to view and initialize counters for page and save page objects at view.
St 4: increment , decrements and reset page objects and fetch records from db on next , previous and reset events .


这篇关于如果使用ASP.NET MVC 5单击上一个和下一个按钮,如何显示db中文本框中的上一个和下一个记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆