How to count total Local Data rows for Data Driven testing and then perform a function on a particular row?

I'm writing test automation scripts that is based on Data Driven testing for Web Browser test. I'm using Local Data as my data source.

Eg: Local Data table contains 2 rows and 2 columns for Username and Password.

I'm wondering is there is a way to perform a row "Count" function for the Local Data table.

And then,if the row count is two, perform a specific function.

The idea is something like this :

if LocalData.Row = 2 then 
     //Execute a function
else
     //Close Browser

I can't seem to find any resources in the net for this. I'm just being introduced to Telerik so i'm learning as it goes and i'm really hoping you guys can help to give some pointers on this question.

Many many thanks in advance :)


ANSWERS:


Column and row are two different things.

When accessing the column by the RAD_Grid.MasterTableView.Columns.

You will be able to modify all the properties of a column. Like :
FilterDelay, CurrentFilterFunction, ShowFilterIcon, DataField, UniqueName, Display, Exportable...

foreach (GridColumn column in RAD_Grid.MasterTableView.Columns)
{
    if (column is GridBoundColumn)
    {
        GridBoundColumn boundColumn = column as GridBoundColumn;
        boundColumn.CurrentFilterValue = string.Empty;
    }
}

To iterate through the row, on the data bound:

protected void Unnamed_DataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
       GridDataItem item = (GridDataItem)e.Item;
       // LOGIC
    }

    //Total Item Count:
    if (e.Item is GridPagerItem)
    {
        int itemsCount = ((GridPagerItem)e.Item).Paging.DataSourceCount;
    }
}

Or

GridItemCollection gridRows = RAD_Grid.Items;
int i;
foreach (GridDataItem data in gridRows)
{    
    i++;
    ItemClass obj = (ItemClass)data.DataItem;
}

As its not really clear what you want I will give you an other way around. In your grid put a templated Column. I' am pretty sure that's what you are looking for. And if the logic is complexe put it in a function in code behind and simply :

<asp:Label ID="lbl_Exmpl" runat="server"
     Text=' <%# MyFunction( Convert.ToInt32(Eval("Mydata")) ) %>' />


 MORE:


 ? How should I retrieve the latest version of a Maven project for contract testing?
 ? How to load test pure java code?
 ? Android Marshmallow: How to allow Runtime Permissions programatically?
 ? casperJS ajax request to localhost but no post req sent
 ? Selenium/Phantomjs: how to tell if a navigation is made?
 ? How to fix PhantomJS rendering on AWS EC2 Ami Linux instance?
 ? Python: Selenium button click doesn't work but '\n' does
 ? Rails 5 test doesn't reproduce actual behaviour on PATCH
 ? Is it possible to test a local value using a junit test?
 ? How to Unit test with different settings in Django?