保留gridview分页中的dropdownlist值的C#代码 [英] c# code for retaining dropdownlist value in gridview paging
问题描述
我正在网格视图中使用下拉列表.
我在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.
推荐答案
不要在设计器中预定义数据,在Page_Load期间填充数据并将填充内容包装在
Don''t predefine the data in the designer, fill it during Page_Load and wrap the filling in a
if(!IsPostBack)
{
<fill the ddl here>
}
确保ddl的EnableViewState为true.
那应该保持您在此会话期间所做的任何更改.
Make sure EnableViewState is true for the ddl.
That should maintain any changes you make (during this session).
您的问题与2010年12月问的相同,都是逐字逐句的.该问题被标记为已解决,因此我建议您参考这个问题.
原始(已解决)问题. [ ^ ]
Your question is word-for-word the same as one asked back in December 2010. That question was marked as solved, so I suggest that you refer to that question.
Original (Solved) question.[^]
这篇关于保留gridview分页中的dropdownlist值的C#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!