示例#1
0
        public static List <Ucenik> PreuzmiUcenike()
        {
            List <Ucenik> ucenici = new List <Ucenik>();

            using (StreamReader sr = new StreamReader(HttpContext.Current.Server.MapPath("~/ucenici.txt")))
            {
                try
                {
                    string line = sr.ReadLine();
                    while (!string.IsNullOrEmpty(line))
                    {
                        Ucenik ucenik = new Ucenik(line);
                        ucenici.Add(ucenik);
                        line = sr.ReadLine();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }
            return(ucenici);
        }
示例#2
0
        protected void btnDodaj_Click(object sender, EventArgs e)
        {
            string line = txtIme.Text + "|" + txtPrezime.Text + "|" + txtRazred.Text;

            Ucenik.DodajUcenika(line);
        }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     GridView1.DataSource = Ucenik.PreuzmiUcenike();
     GridView1.DataBind();
 }