tags:

views:

32

answers:

1

This is my code in c#

protected void ibtCopiar_Click(object sender, 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;
                    }
               }

    }

this my code for the button

when i debug i see that the value i have in the firts box is pass to the other textboxes in the column, but when it dysplay the page onle the first box show the value i have enter. the other texboxes don´t change.

A: 

If the other cells contain textboxes as well, you will need to find them and set their text value.

foreach (GridViewRow grdrow in DGPlanilla.Rows)
{
    TextBox toDisplay = (TextBox)grdrow.FindControl("TextBox1");
    toDisplay.Text = valor;
}
Matthew Jones
I did try thatTextBox tb2 = (TextBox)grdrow.FindControl("TextBox1"); tb2.Text = string.Empty; tb2.Text = valor;and i had the same result, only the first textbox chance the value