ivana_andreevska

АВ2 Задача 5

Mar 10th, 2022
1,032
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.74 KB | None | 0 0
  1. <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="AV2.WebForm1" %>
  2. <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
  3.     <div class="container-fluid">
  4.  
  5.         <div class="row text-center ">
  6.  
  7.             <div class="m-4">
  8.                 Внесете име на валута
  9.                 <br />
  10.                 <asp:TextBox ID="ImeValuta" runat="server"></asp:TextBox>
  11.             </div>
  12.  
  13.             <div class="m-4">
  14.                 Внесете вредност на валута
  15.                 <br />
  16.                 <asp:TextBox ID="VrednostValuta" runat="server"></asp:TextBox>
  17.             </div>
  18.                
  19.             <div class="m-4">
  20.                 <asp:Button ID="DodadiValuta" runat="server" Text="Додади Валута" OnClick="DodadiValuta_Click" />
  21.                 <asp:Button ID="IzbrisiValuta" runat="server" Text="Избриши Валута" OnClick="IzbrisiValuta_Click" />
  22.             </div>
  23.  
  24.             <hr />
  25.  
  26.             <div class="m-4">
  27.                 <asp:RadioButtonList ID="ListaValuti" runat="server"></asp:RadioButtonList>
  28.             </div>
  29.  
  30.             <hr />
  31.              <div class="m-4">
  32.                Вкупно валути: <asp:Label ID="total" runat="server" Text="0"></asp:Label>
  33.             </div>
  34.  
  35.             <br />
  36.             <hr />
  37.             <div class="m-4">
  38.                 Статус:  <asp:Label ID="status" runat="server" Text="0"></asp:Label>
  39.             </div>
  40.  
  41.  
  42.  
  43.         </div>
  44.  
  45.     </div>
  46. </asp:Content>
  47.  
  48.  
  49.  using System;
  50. using System.Collections.Generic;
  51. using System.Linq;
  52. using System.Web;
  53. using System.Web.UI;
  54. using System.Web.UI.WebControls;
  55.  
  56. namespace AV2
  57. {
  58.     public partial class WebForm1 : System.Web.UI.Page
  59.     {
  60.         protected void Page_Load(object sender, EventArgs e)
  61.         {
  62.  
  63.         }
  64.  
  65.         protected void DodadiValuta_Click(object sender, EventArgs e)
  66.         {
  67.             ListItem item = new ListItem(ImeValuta.Text, VrednostValuta.Text);
  68.             ListaValuti.Items.Add(item);
  69.             ImeValuta.Text = "";
  70.             VrednostValuta.Text = "";
  71.             updateTotal();
  72.         }
  73.  
  74.         protected void IzbrisiValuta_Click(object sender, EventArgs e)
  75.         {
  76.             if(ListaValuti.SelectedIndex!=-1)
  77.             {
  78.                 ListaValuti.Items.Remove(ListaValuti.SelectedItem);
  79.                 updateTotal();
  80.             }
  81.             else
  82.             {
  83.                 status.Text = "Nemate selektirano nitu edna valuta!";
  84.             }
  85.         }
  86.  
  87.         private void updateTotal()
  88.         {
  89.             total.Text = ListaValuti.Items.Count.ToString();
  90.         }
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment