Exemple #1
0
    protected void btnPDPmeninggal_Click(object sender, EventArgs e)
    {
        //kirim data ke web service
        webService.Service objek = new webService.Service();
        int jmlPDPmeninggal      = objek.PDP_Meninggal(Convert.ToInt32(txtPDPmeninggal.Text));

        pesan.Text = "jumlah PDP Meninggal : " + jmlPDPmeninggal.ToString() + " Telah di input";

        //method isi ke tabel
        foreach (GridViewRow row in GridView1.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                //input ke tabel kolom databaru
                if (row.RowIndex == 0)
                {
                    Label lb11 = (Label)row.FindControl("Label3");
                    lb11.Text = txtPDPmeninggal.Text;
                }
                //input ke tabel kolom total data
                if (row.RowIndex == 1)
                {
                    Label lb12 = (Label)row.FindControl("Label3");

                    int data_baru = Convert.ToInt32(txtPDPmeninggal.Text);
                    total_data_pdp_meninggal = data_baru + total_data_pdp_meninggal;
                    lb12.Text = Convert.ToString(total_data_pdp_meninggal);
                }
            }
        }
        txtPDPmeninggal.Text = ""; //untuk clear textbox
    }
    protected void btninput_Click(object sender, EventArgs e)
    {
        try
        {
            webService.Service objek = new webService.Service();

            int jmlODP = objek.ODP(Convert.ToInt32(txtOdp.Text));
            lblInput.Text = "jumlah ODP : " + jmlODP.ToString() + " Telah di input";


            foreach (GridViewRow row in GridView1.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    if (row.RowIndex == i)
                    {
                        Label lb11 = (Label)row.FindControl("Label1");
                        Label lb12 = (Label)row.FindControl("Label2");
                        Label lb13 = (Label)row.FindControl("Label3");
                        Label lb14 = (Label)row.FindControl("Label4");
                        Label lb15 = (Label)row.FindControl("Label5");
                        lb11.Text = txtNamaDesa.Text;
                        lb12.Text = txtRt.Text;
                        lb13.Text = txtRw.Text;
                        lb14.Text = txtKecamatan.Text;
                        lb15.Text = txtOdp.Text;
                    }
                }
            }
            i++;
            bersih();
        }
        catch (Exception x)
        {
            Response.Write(x + "EROR BOS");
        }
    }