使用gridview和formview绑定维护FormView.PageIndex [英] Maintain FormView.PageIndex using gridview and formview bound

查看:55
本文介绍了使用gridview和formview绑定维护FormView.PageIndex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用gridview / formview作为主/详细信息。 gridview和formview绑定到相同的数据源。有一个菜单控件可以控制要显示的formview控件。最初,我设置gridview = 0的selectedindex并显示相关的formview控件(数据源有3条记录,formview.PageCount = 3)。这没有问题。但是,当我选择另一条记录时,formview.PageCount = 3,一旦我点击另一个菜单项并返回之前点击了formview.PageCount = 1和formview.PageIndex = 0;



if(menuItm.Selected =Status Info)

{

int thisRow = theGrid.SelectedIndex;

if(theForm.PageIndex!= theGrid.SelectedIndex)

{

theForm.PageIndex = theGrid.SelectedIndex;

gvwtheGrid_SelectedIndexChanged(theGrid,null)

}



//有代码显示包含formview的视图

// theForm设置为可见。



如果设置了Form.PageIndex,我怎么能坚持?



谢谢,

I am using a gridview/formview to function as master/detail. The gridview and formview are bound to the same datasource. There is a menu control that controls which formview control to show. Initially, I am setting the selectedindex of the gridview = 0 and displaying the associated formview control (the datasource has 3 records, formview.PageCount = 3). This works without issues. However, when I select another record the formview.PageCount = 3, the formview is populated with the data, once I click another menu item and return to the one previously clicked the formview.PageCount = 1 and the formview.PageIndex = 0;

if (menuItm.Selected = "Status Info")
{
int thisRow = theGrid.SelectedIndex;
if (theForm.PageIndex != theGrid.SelectedIndex)
{
theForm.PageIndex = theGrid.SelectedIndex;
gvwtheGrid_SelectedIndexChanged(theGrid, null)
}

//there is code to show the view which contains the formview
//theForm is set to visible.

How can I persist the Form.PageIndex once it has been set?

Thanks,

推荐答案

因为页面正在重新加载,为了保持pageindex值,你使用了像隐藏字段/ querystrin这样的技术g保存该值并在加载时将所选索引设置为该值。
Because the page is getting reloaded, to persist pageindex value, you have use a technique like hidden field / querystring to save that value and on load set selected index to that value.


这篇关于使用gridview和formview绑定维护FormView.PageIndex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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