簡體   English   中英

我需要將文本從gridview texbox復制到該列中的其他文本

[英]I need to copy the text from a gridview texbox to the others in the column

這是我在C#中的代碼

受保護的無效ibtCopiar_Click(對象發送者,ImageClickEventArgs e){

           GridViewRow grdrows = DGPlanilla.Rows[0];
            TextBox tb1 = (TextBox)grdrows.FindControl("TextBox1");
            string valor = tb1.Text;

                if (valor != null || valor != "0")
                {
                    foreach (GridViewRow grdrow in DGPlanilla.Rows)
                    {
                        grdrow.Cells[5].Text = valor;
                    }
               }

    }

這是我的按鈕代碼

當我調試時,我看到我在firts框中具有的值將傳遞給該列中的其他文本框,但是當它在頁面上顯示不正常時,第一個框將顯示我輸入的值。 其他texbox不變。

如果其他單元格也包含文本框,則需要找到它們並設置其文本值。

foreach (GridViewRow grdrow in DGPlanilla.Rows)
{
    TextBox toDisplay = (TextBox)grdrow.FindControl("TextBox1");
    toDisplay.Text = valor;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM