Yes dude , you are right , you can surely provide list of objects as the datasource , as gridview can handle any source that implements iEnumerable interface.
suppose you have a class named classA. then to provide list of objects of type classA. you can do something as below:
List<classA> lst=new List<classA>();
GridView1.Datasource=lst;
GridView1.DataBind();
< GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="Prop1" HeaderText="Property 1" />
<asp:TemplateField HeaderText="Property 2">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Prop2") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Prop2") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
And yes you can use for loop for solving your second problem .
also you can use the same foreach loop with minor modification as shown below:
using (Stream s = file.InputStream)
{
string[] numberOfUsers;
var sr = new StreamReader(s);
string contacts = sr.ReadToEnd();
contacts = contacts.Replace("\r\n", "\n");
string[] separateLines = contacts.ToString().Split('\n');
foreach (string line in separateLines)
{
numberOfUsers = line.Split(',');
int count=0;
foreach( string fieldOnLine in numberOfUsers )
{
if(count>0)
{
}
count++;
}
}