Lamin L. Janneh
Lamin L. Janneh

Reputation: 95

How to conditionally disable an item template field in a Gridview?

private void hidePartPayment()
{
    foreach (GridViewRow row in invoices.Rows)
    {
        var cb = (CheckBox)row.FindControl("Check");
        if (!cb.Enabled)
        {
            //row.Cells[12]. this is not working
            row.Cells[12].Enabled = false;   
        }
    }
}

I have a popup window on a gridview, I want to disable the link based on the condition above (non clickable) but is not working.

Upvotes: 1

Views: 1479

Answers (1)

Mahedee
Mahedee

Reputation: 166

Did you debug the code? Does your code come to the point

row.Cells[12].Enabled = false;

Then please check the column row.Cells[12] in quick watch. May be its not correct row your are pointing.

Upvotes: 1

Related Questions