Asp uygulama

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="asp_nothesapla.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cstyle%3E%0D%0A%20%20%20%20%20%20%20%20.td1%20%7B%0D%0A%20%20%20%20%20%20%20%20%20width%3A100px%3B%0D%0A%20%20%20%20%20%20%20%20%20height%3A250px%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%0D%0A%20%20%20%20%3C%2Fstyle%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="<style>" title="<style>" />
</head>
<body>
    <form id="form1" runat="server">
    <div >
    <table>
        <tr>
            <td style="text-align:center">Vize</td>  <td style="text-align:center">Final</td>   <td style="text-align:center">Ortalama</td>

        </tr>
        <tr>
            <td class="td1">
                <asp:ListBox ID="lvize" runat="server" Width="100px" Height="250px" ></asp:ListBox></td >
            <td class="td1"> <asp:ListBox ID="lfinal" runat="server" Width="100px" Height="250px" ></asp:ListBox></td>
            <td class="td1"> <asp:ListBox ID="lort" runat="server" Width="100px" Height="250px" ></asp:ListBox></td>
           <td> 
        <div>     
       <table>
          
              <tr><td>Vize:</td><td><asp:TextBox ID="tdvize" runat="server"></asp:TextBox></td></tr>
              <tr><td>Final:</td><td><asp:TextBox ID="tdfinal" runat="server"></asp:TextBox></td></tr>
               <tr><td colspan="2" style="text-align:center"><asp:Button ID="btnduz" runat="server" Text="Güncelle" OnClick="btnduz_Click" /></td></tr>
      </table>
            </div> 
        </td>     
        </tr>
        <tr>
             <td><asp:TextBox ID="tvize" width="97px" runat="server"></asp:TextBox></td>
             <td><asp:TextBox ID="tfinal" width="97px" runat="server"></asp:TextBox></td>
             <td> <asp:Label ID="Label1" runat="server" width="97px" Text="Label"></asp:Label></td>
           
        </tr>
        <tr>
            <td><asp:Button ID="Bekle" runat="server" Text="Ekle" Width="100px" OnClick="Bekle_Click" /></td>
             <td><asp:Button ID="bsil" runat="server" Text="Sil" Width="100px" OnClick="bsil_Click"/></td>
             <td><asp:Button ID="bguncelle" runat="server" Text="Düzenle" Width="100px" OnClick="bguncelle_Click"/></td>
        </tr> 
    </table>
    </div>
    </form>
</body>
</html>
  private void genelnot()
        {
            int boyut = lvize.Items.Count;
            double genort = 0;
            for (int i = 0; i < boyut; i++)
            {
                double gecici = 0;
                double.TryParse(lort.Items[i].Value, out gecici);
                genort += gecici;
            }
            genort /= boyut;
            Label1.Text = "Genel Ortalama=" + genort;
        }
        protected void Bekle_Click(object sender, EventArgs e)
        {
            double final = 0, vize = 0;
            Boolean v = double.TryParse(tvize.Text, out vize);
            Boolean f = double.TryParse(tfinal.Text, out final);
            if (v & f)
            {
                double ort = 0.4 * vize + 0.6 * final;
                lvize.Items.Add(vize+"");
                lfinal.Items.Add("" + final);
                lort.Items.Add("" + ort);
                genelnot();
            }
            tvize.Text = "";
            tfinal.Text = "";
        }

        protected void bsil_Click(object sender, EventArgs e)
        {
            int secilen = lvize.SelectedIndex;
            if (secilen > -1)
            {
                lvize.Items.RemoveAt(secilen);
                lfinal.Items.RemoveAt(secilen);
                lort.Items.RemoveAt(secilen);
            }
            genelnot();
        }
        int secilen;
        protected void bguncelle_Click(object sender, EventArgs e)
        {  
            secilen = lvize.SelectedIndex;
            if (secilen > -1)
            {
                tdvize.Text = (string)lvize.Items[secilen].Value;
                tdfinal.Text = (string)lfinal.Items[secilen].Value;
            }
        }

        protected void btnduz_Click(object sender, EventArgs e)
        {
            double final = 0, vize = 0;
            Boolean v = double.TryParse(tdvize.Text, out vize);
            Boolean f = double.TryParse(tdfinal.Text, out final);
            if (v&&f)
            {     double ort = 0.4 * vize + 0.6 * final;
                lvize.Items.RemoveAt(secilen);
                lfinal.Items.RemoveAt(secilen);
                lort.Items.RemoveAt(secilen);
                lvize.Items.Insert(secilen, "" + vize);
                lfinal.Items.Insert(secilen, ""+final);
                lort.Items.Insert(secilen, "" + ort);
                genelnot();
                tdfinal.Text = "";
                tdvize.Text = "";
            }
        }

 

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir