Looping through a Lisbox created on the fly
===

I am working on exporting data and right now some fields export the value, instead of the text. So I am saving the object that returns the text and value to a list box and matching it to the value in the listbox from the object like so:

    MaterialDB materials = new MaterialDB();
    DropDownList listBoxMaterials = new DropDownList();
    listBoxMaterials.DataSource = materials.GetItems(ModuleId, TabId);
    listBoxMaterials.DataBind();
    
    string materialString = "";
    
    
    foreach (ListItem i in listBoxMaterials.Items)
    {
        if (i.Value == row["MaterialTypeID"].ToString())
        {
            materialString = i.Text;
        }
    }

When I use this for the i.Value it always returns "System.Data.DataRowView" instead of the actual value. I'm doing this all in code behind. Anyway around this to get it to work?

Thanks!