avenugop

avenugop

  • NA
  • 1
  • 0

datagrid problem with dynamically bound columns

Jan 25 2005 12:21 PM
i have a datagrid in my web forms, where i'm binding columns at run time... however, for these bound columns, there are some problems in some of the datagrid event handlers... * although the edit command recognized the columns in the grid (i am even able to make some columns read-only here...), the update command does not recognize the existence of the bound columns and keeps saying that 'specified parameter was invalid: index out of range' when i tried to access e.Item.Cells[x] where x is the column number... i tried to use e.Item.Cells[x].Controls[0] but Controls[0] does not seem to be working anyways with bound columns... Is there a way to fix this OR to get access to the columns' information in the Update Command? * when i am binding the columns at run time, i set the sortExpression of the bound columns to the header text of the column... and when I try to access this in the Sort Command event of the DataGrid and try to Re-Bind according to SortExpression, I either get all columns generated 2 times(when I re-bind the DataGrid at both the Sort Command as well as Page_load) or do not get the columns to be bound at all (when I try to Re-Bind either ONLY at the Sort Command event handler OR ONLY at the Page_Load)... please advise on both issues if you have any ideas... thanks a lot - arvind

Answers (1)