Şimdi Ara

Buton click ile eklenen satır ikinci click'te siliniyor.

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir - 2 Masaüstü
5 sn
1
Cevap
0
Favori
289
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • asp:table load esnasında 3 satır ve butonla click olayında 1 satır eklemeye çalışıyorum.Ancak button click olduğunda önceki satır siliniyor.Kodlar aşağıdaki gibi;`

    using System; 
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace pr_po_useridrequestform
    {
    public partial class WebForm1 : System.Web.UI.Page
    {
    CheckBox newcheckbox(string name)
    {
    CheckBox chck = new CheckBox();
    chck.ID = name;
    return chck;
    }
    TableCell newtablecell(string name)
    {
    TableCell new_cell = new TableCell();
    new_cell.ID = name;
    return new_cell;
    }
    TextBox newtextbox(string name)
    {
    TextBox new_txt = new TextBox() ;
    new_txt.ID = name;
    return new_txt;
    }
    string chckname,cellname,txtname;
    void addapproverinformation(int number)
    {

    for (int i = 0; i < number; i++)
    {
    int numOfRows = tbl_accountcategories.Rows.Count;
    Response.Write(numOfRows);
    TableCell new_cell=new TableCell(); ;
    TableRow new_row = new TableRow();

    chckname = "chck_Al" + numOfRows;
    cellname = "cell_Al" + numOfRows;
    new_cell = newtablecell(cellname);
    new_row.Cells.Add(new_cell);
    new_cell.Controls.Add(newcheckbox(chckname));



    chckname = "chck_K" + numOfRows;
    cellname = "cell_K" + numOfRows;
    new_cell = newtablecell(cellname);
    new_row.Cells.Add(new_cell);
    new_cell.Controls.Add(newcheckbox(chckname));


    chckname = "chck_F" + numOfRows;
    cellname = "cell_F" + numOfRows;
    new_cell = newtablecell(cellname);
    new_row.Cells.Add(new_cell);
    new_cell.Controls.Add(newcheckbox(chckname));

    chckname = "chck_Y" + numOfRows;
    cellname = "cell_Y" + numOfRows;
    new_cell = newtablecell(cellname);
    new_row.Cells.Add(new_cell);
    new_cell.Controls.Add(newcheckbox(chckname));


    chckname = "chck_Z" + numOfRows;
    cellname = "cell_Z" + numOfRows;
    new_cell = newtablecell(cellname);
    new_row.Cells.Add(new_cell);
    new_cell.Controls.Add(newcheckbox(chckname));


    chckname = "chck_J" + numOfRows;
    cellname = "cell_J" + numOfRows;
    new_cell = newtablecell(cellname);
    new_row.Cells.Add(new_cell);
    new_cell.Controls.Add(newcheckbox(chckname));


    chckname = "chck_Blank" + numOfRows;
    cellname = "cell_Blank" + numOfRows;
    new_cell = newtablecell(cellname);
    new_row.Cells.Add(new_cell);
    new_cell.Controls.Add(newcheckbox(chckname));


    tbl_accountcategories.Rows.Add(new_row);
    tbl_accountcategories.DataBind();



    TableRow new_row2 = new TableRow();

    txtname = "txFormerapprover" + numOfRows;
    cellname = "cell_Formapprover" + numOfRows;
    new_cell = newtablecell(cellname);
    new_cell.Controls.Add(newtextbox(txtname));
    new_row2.Cells.Add(new_cell);

    txtname = "txNewapprover" + numOfRows;
    cellname = "cell_Newapprover" + numOfRows;
    new_cell = newtablecell(cellname);
    new_cell.Controls.Add(newtextbox(txtname));
    new_row2.Cells.Add(new_cell);

    txtname = "txPosition" + numOfRows;
    cellname = "cell_Position" + numOfRows;
    new_cell = newtablecell(cellname);
    new_cell.Controls.Add(newtextbox(txtname));
    new_row2.Cells.Add(new_cell);

    txtname = "txApprovalamount" + numOfRows;
    cellname = "cell_Approvalamount" + numOfRows;
    new_cell = newtablecell(cellname);
    new_cell.Controls.Add(newtextbox(txtname));
    new_row2.Cells.Add(new_cell);
    txt_Ba.Text = tbl_accountcategories.Rows.Count.ToString();

    tbl_accountcategoriestxt.Rows.Add(new_row2);
    tbl_accountcategoriestxt.DataBind();


    }
    }

    protected void btn_Addapproverinformationrows_Click(object sender, EventArgs e)
    {
    addapproverinformation(1);
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    addapproverinformation(3);
    }



    }
    }







  • Yapay Zeka’dan İlgili Konular
    pdf de yazdır tuşu aktif değil
    18 yıl önce açıldı
    Daha Fazla Göster
    
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.