本文介绍了如何突出在DevEx preSS MVC GridView控件的页面的特定行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要选择一个DevEx preSS MVC GridView控件,其中包含一个键值的特定行。我尝试以下codeS在GridView。

I want to select a particular row of a DevExpress MVC GridView, which contains a keyvalue. I tried the following codes in the gridview.

settings.DataBound = (sender, e) =>
    {
        MVCxGridView grid = (MVCxGridView)sender;

        grid.PageIndex = 5;

    };

    settings.PreRender = (sender, e) =>
    {

        MVCxGridView grid = (MVCxGridView)sender;

        grid.FocusedRowIndex = grid.FindVisibleIndexByKeyValue(35);



    };

下面是我希望得到的是要突出包含键值35以上code不为我工作了行选择。第5页的行

Here what I wish to get is to highlight the row of 5th page which contains the keyvalue 35. The above code does not work for me for row selection.

请任何人提出解决方案。

Please anybody suggest a solution.

先谢谢了。

推荐答案

我是用客户方的解决方案Ja​​vaScript函数。

I got a solution which is using a clientside javascript function.

 settings.PreRender = (sender, e) =>
   {

       MVCxGridView grid = (MVCxGridView)sender;

       var selected = 35;
       if (Convert.ToInt64(selected) > 0)
       {
           int index = grid.FindVisibleIndexByKeyValue(selected );

           grid.PageIndex = index / grid.SettingsPager.PageSize;

           grid.ClientSideEvents.Init = @"function(s, e) 
           { s.SetFocusedRowIndex(" + index + ");}";

      }

   };

这篇关于如何突出在DevEx preSS MVC GridView控件的页面的特定行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:27