J
Jeff
hi
asp.net 2.0
I'm having trouble with this RowDataBound method. the problem is when I
click on the edit buttton on a row and wants to edit the row, then the
textbox isn't filled with data... but if I click on the edit button on a
different row then the textbox gets its value... so it looks like this code
only works on every second row I click on.. But I want it to work on every
row...
Here is the entire method:
protected void gvTest_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Category category = (Category)e.Row.DataItem;
if ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState ==
DataControlRowState.Alternate))
{
Literal literal = (Literal)e.Row.FindControl("litTest");
literal.Text = car.Name;
}
else if (e.Row.RowState == DataControlRowState.Edit)
{
TextBox textbox = (TextBox)e.Row.FindControl("txtTest");
textbox .Text = car.Name;
}
}
}
any ideas what I do wrong?
asp.net 2.0
I'm having trouble with this RowDataBound method. the problem is when I
click on the edit buttton on a row and wants to edit the row, then the
textbox isn't filled with data... but if I click on the edit button on a
different row then the textbox gets its value... so it looks like this code
only works on every second row I click on.. But I want it to work on every
row...
Here is the entire method:
protected void gvTest_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Category category = (Category)e.Row.DataItem;
if ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState ==
DataControlRowState.Alternate))
{
Literal literal = (Literal)e.Row.FindControl("litTest");
literal.Text = car.Name;
}
else if (e.Row.RowState == DataControlRowState.Edit)
{
TextBox textbox = (TextBox)e.Row.FindControl("txtTest");
textbox .Text = car.Name;
}
}
}
any ideas what I do wrong?