bonCodigo
bonCodigo

Reputation: 14361

RowState is not changing to edit mode (infact "editable" row just doens't get caught by RowDataBound)

For the past 2 weeks I have been experience the most unbelievably excellent scenarios with GridView and its related controls...properties. I praise to anyone who had encountered these issues earlier.

The latest issue is with RowState check at RowDataBound.

When I click on the Edit linkbutton in GridView, by right the RowState must be edit. However, RowState remains normal in following code, thus not allowing me to do anything that should be done for row editing mode.

Why is this happening? I have tried out every possible bit-wise combination to capture the edit for RowState. Still no luck...

protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        if (e.Row.RowState == DataControlRowState.Edit)

Here's what I have discovered on debug mode... When edit button is clicked for Row 3 (edit index is 2) for an example, the RowDataBound is fired. The event is going through each Row from index 0 to 1 but it doesn't come to index 2. Therefore the row which is in edit mode NEVER seem to go through RowDataBound event. All the other related issues that I am having with TemplateFields of edit mode are inter-connected to this issue.

Upvotes: 0

Views: 734

Answers (0)

Related Questions