Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27210

VS 2012 Please convert this to use a Datatable

$
0
0
Hi Guys,

Please convert these two blocks of code for me. I need to use a datatable on the highlighted line:

Code:

  List<DataRowView> selectResult = Products.Select(DataSourceSelectArguments.Empty).Cast<DataRowView>().ToList();
        for(int i = 0; i < selectResult.Count; i++) {
            if(IsSuitableItem(selectResult[i])) {
                ASPxDataView1.PageIndex = i / ASPxDataView1.PageCount;
                return;
            }
        }

Code:

bool IsSuitableItem(object dataItem) {
        string searchText = searchTextBox.Text.ToLower();
        if(dataItem != null && !string.IsNullOrEmpty(searchText)) {
            string valueText = DataBinder.Eval(dataItem, "ProductName").ToString().ToLower();
            return (valueText.Contains(searchText));
        }
        return false;
    }


Viewing all articles
Browse latest Browse all 27210

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>