This is not quite the correct approach.
You are actually overriding the gridview source in every iteration of the loop.
Try something similar to this
string xxxx = "select title from document where id in('";
for (int k = 0; k < intArray.Length; k++)
{
xxxx+=intArray[k]+"',"
}
xxxx=xxxx.SubString(0,xxxx.length-1) + ")";
ad1 = new SqlDataAdapter(xxxx, c.getcon());
ds1 = new DataSet();
ad1.Fill(ds1);
if (ds.Tables[0].Rows.Count != 0)
{
GridView1.DataSource = ds1;
GridView1.DataBind();
}