Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.IO;
- namespace WebApplication4
- {
- public partial class _Default : System.Web.UI.Page
- {
- private ocena o = new ocena();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (DropDownList1.Items.Count == 0)
- {
- List<string> lista = napuniListu();
- DropDownList1.Items.Clear();
- foreach (string line in lista)
- {
- DropDownList1.Items.Add(line);
- }
- }
- }
- private List<string> napuniListu()
- {
- List<string> lista = new List<string>();
- try
- {
- StreamReader sr = new StreamReader(HttpContext.Current.Server.MapPath("~/Ucenici.txt"));
- string line = sr.ReadLine();
- string[] a;
- while (!string.IsNullOrEmpty(line))
- {
- a = line.Split('|');
- line = a[0] + " " + a[1];
- lista.Add(line);
- line = sr.ReadLine();
- }
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- }
- return lista;
- }
- protected void Button1_Click1(object sender, EventArgs e)
- {
- string line = DropDownList1.SelectedItem.Text;
- string[] info = line.Split(' ');
- Label1.Text = "Prosecna ocena: " + o.ucitajOcenu(info[0], info[1]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement