Check with the below code.
public ArrayList GetPos()
{
ArrayList list = null;
if (HttpContext.Current.Session["ArrayPos"] == null)
{
list = new ArrayList();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText = "select firstname,name,CONVERT(VARCHAR(20),birthday,102) birthday from Info";
cmd.Connection = con;
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
list.Add(string.Join(";", rdr["firstname"], rdr["name"], rdr["birthday"]));
}
HttpContext.Current.Session["ArrayPos"] = list;
}
else
{
list = HttpContext.Current.Session["ArrayPos"] as ArrayList;
}
return list;
}
protected void Button1_Click(object sender, EventArgs e)
{
ArrayList dt = GetPos();
int index = 0;
string[] pos = dt[index].ToString().Split(';');
FirstName.Text = pos[0].ToString();
Name.Text = pos[1].ToString();
string[] bDate = pos[2].Split('.');
Birthday.Text = bDate[2] + "." + bDate[1] + "." + bDate[0];
}