重置分页时选择的 gridView 行
Reset gridView row selected while paging
我有一个包含三个选项卡的 pageView,每个选项卡都有自己的 radGridView。在 pageView 下方,我有一个表单显示一些不在 gridView 中的字段。当页面加载时,表单将填充第一个 gridView 的第一个值。但是当我更改选项卡时,我无法将焦点设置到 'new' gridView。有什么解决这个问题的技巧吗?
试试这个:
Private void radPageView_SelectedPageChanged(object sender, EventArgs e)
{
if (radPageView1.SelectedPage == radPageView1.Pages["radPageViewPage1"])
{
if (this.radGridView1.Rows.Count > 0)
{
if (this.radGridView1.Rows.Count == 0)
{
this.radGridView1.Rows[0].IsSelected = true;
}
this.radGridView2.HideSelection = true;
this.radGridView2.ClearSelection();
this.radGridView2.UnSelectAllRows();
this.radGridView1.Focus();
}
else
{
_frmEmbededForm.ResetUI(); //ResetUI is my method
}
}
else if (radPageView1.SelectedPage == radPageView1.Pages["radPageViewPage2"])
{
if (this.radGridView2.Rows.Count > 0)
{
if (this.radGridView2.Rows.Count == 0)
{
this.radGridView2.Rows[0].IsSelected = true;
}
this.radGridView1.HideSelection = true;
this.radGridView1.ClearSelection();
this.radGridView1.UnSelectAllRows();
this.radGridView2.Focus();
}
else
{
_frmEmbededForm.ResetUI(); //ResetUI is my method
}
}
}
我有一个包含三个选项卡的 pageView,每个选项卡都有自己的 radGridView。在 pageView 下方,我有一个表单显示一些不在 gridView 中的字段。当页面加载时,表单将填充第一个 gridView 的第一个值。但是当我更改选项卡时,我无法将焦点设置到 'new' gridView。有什么解决这个问题的技巧吗?
试试这个:
Private void radPageView_SelectedPageChanged(object sender, EventArgs e)
{
if (radPageView1.SelectedPage == radPageView1.Pages["radPageViewPage1"])
{
if (this.radGridView1.Rows.Count > 0)
{
if (this.radGridView1.Rows.Count == 0)
{
this.radGridView1.Rows[0].IsSelected = true;
}
this.radGridView2.HideSelection = true;
this.radGridView2.ClearSelection();
this.radGridView2.UnSelectAllRows();
this.radGridView1.Focus();
}
else
{
_frmEmbededForm.ResetUI(); //ResetUI is my method
}
}
else if (radPageView1.SelectedPage == radPageView1.Pages["radPageViewPage2"])
{
if (this.radGridView2.Rows.Count > 0)
{
if (this.radGridView2.Rows.Count == 0)
{
this.radGridView2.Rows[0].IsSelected = true;
}
this.radGridView1.HideSelection = true;
this.radGridView1.ClearSelection();
this.radGridView1.UnSelectAllRows();
this.radGridView2.Focus();
}
else
{
_frmEmbededForm.ResetUI(); //ResetUI is my method
}
}
}