|
 |
aspdotnet_website_programming thread: DataGrid with dynamic created columns don't sort
Message #1 by "Andre Girgner" <andre@g...> on Sun, 24 Nov 2002 20:59:49
|
|
Hi, I'm working on a DataGrid with a customized pager and others. I add
the columns on the fly within the Page_Load event. All is working fine. I
would use the Sort feature of the DataGrid. After clicking on the column
header only the hard coded columns (declared within the HTML section) are
displayed. The Sort event handler is never called :-( Any ideas ?
Regards,
Andre
PS: The columns are added with this ...
Sub AddBoundColumn(HeaderText As String, DataField As String)
Dim Column As New BoundColumn()
With Column
.HeaderText = HeaderText
.DataField = DataField
.SortExpression = DataField
End With
ctlDataGrid.Columns.Add(Column)
End Sub
Message #2 by "Andre Girgner" <andre@g...> on Wed, 27 Nov 2002 19:16:56
|
|
just for the case, that a other guy run into the same problem. The
solution is very simple: add the columns on the Page_Init event (not
Page_Load)
Andre
> Hi, I'm working on a DataGrid with a customized pager and others. I add
t> he columns on the fly within the Page_Load event. All is working fine.
I
w> ould use the Sort feature of the DataGrid. After clicking on the column
h> eader only the hard coded columns (declared within the HTML section)
are
d> isplayed. The Sort event handler is never called :-( Any ideas ?
> Regards,
A> ndre
>
P> S: The columns are added with this ...
> Sub AddBoundColumn(HeaderText As String, DataField As String)
> Dim Column As New BoundColumn()
> With Column
> .HeaderText = HeaderText
> .DataField = DataField
> .SortExpression = DataField
> End With
> ctlDataGrid.Columns.Add(Column)
> End Sub
|
|
 |