如何保留分页中的下拉列表值??? [英] How to retain drop down list values in paging???

查看:79
本文介绍了如何保留分页中的下拉列表值???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在网格视图中使用下拉列表.

我在ddl中有预定义的数据.我正在使用分页.

我在第一页.我在ddl中有一些数据.我更改了ddl中的数据,然后转到第二页.如果我从第二页回到第一页,则它不会保留更改后的值.它正在获取默认值.

我想从第二页回到第一页后保留这些值.

如果您能在这方面帮助我,那就太好了.

Hi,

I am using drop down lists in grid view.

I have predefined data in ddl. I am using pagination.

I am in first page. I have some data in ddl. I changed data in ddl and going to second page. If I come back to first page from 2nd page, it is not retaining changed values. It is getting default values.

I want to retain the values after coming back to first page from second page.

It would be great if u can help me out in this regard.

Thank you so much in advance.

推荐答案

您必须将选定的值保持在某个位置,并再次显示选定的项目.
看看下面的文章.它会帮你
维护GridView内部不同页面中选定复选框的状态
You have to maintain the selected value somewhere and show the selected item once again loaded.
Have a look to the following article. It''ll help you
Maintaining States of Selected CheckBoxes in Different Pages inside the GridView


我在ddl中有一些数据.我更改了ddl中的数据,然后转到第二页.如果我从第二页回到第一页,则它不会保留更改后的值.它正在获取默认值
确保将下拉填充代码放在属性IsPostback 中.确保它不会在每次页面回发时都重新填充.
I have some data in ddl. I changed data in ddl and going to second page. If I come back to first page from 2nd page, it is not retaining changed values. It is getting default values
Sure you put the dropdown populating code in page IsPostback property. Make sure it is not getting repopulated on every page postback.


这有点棘手的逻辑.

每次从一页移动到另一页时,数据都会重新加载.

选项1

将每个页面导航上的DDL选定的值数据保存到DB中.
在绑定时,您将检查保存的值并更改DDL的选定索引.

选项2

将所选值存储在某个临时位置并重复使用(但是您可以保存房屋值吗?如果还有更多页面?)
This is bit tricky logic.

Every time you move from 1 page to other, the data will get loaded freshly.

Option 1

Save the selected value data of DDL on every page navigation in to the DB.
Onbind you check the saved value and change the selected index of the DDL.

Option 2

Store the selected value in some temporary place and re-use(But home values you can save? If the pages more?)
Please ref Brij Ans


这篇关于如何保留分页中的下拉列表值???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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