문제

I have gridview with autogenerated columns.I have added a column dynamically in the row databound event.

     if (e.Row.RowType == DataControlRowType.DataRow)
    {
        TableCell cell1 = new TableCell();
        e.Row.Cells.Add(cell1);
    }

       // to add header
    else
    {
        TableCell cell1 = new TableCell();
        cell1.Text = "<span style='font-weight:bold'>NAME";
        e.Row.Cells.Add(cell1);
    }   

This column gets added at the end. I want to add this column in the index 2.

Any one can help me please? Thanks in Advance.

도움이 되었습니까?

해결책

Use AddAt(int index, TableCell cell) instead

Example:

e.Row.Cells.AddAt(2, cell1);

Hope this will help !!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top