necesito ayuda para ordenar las columnas de un datagrid !!
Si tengo definido el datagrid como :
<asp:datagrid id="Consulta1" runat="server" CssClass="formTxt" Visible="False" Width="100%" AutoGenerateColumns="false"
PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="Consulta1_Page"
BorderColor="Black" BorderWidth="1px" CellPadding="3" OnSortCommand="Consulta1_Sort" AllowSorting="true" AllowPaging="True">
<AlternatingItemStyle Wrap="False" Height="12px"/>
<ItemStyle HorizontalAlign="Center"/>
<HeaderStyle HorizontalAlign="Center" CssClass="Bold"/>
<PagerStyle NextPageText="Sig." PrevPageText="Ant." HorizontalAlign="Right" Mode="NumericPages" Visible="False" />
</asp:datagrid>
Con: OnSortCommand="Consulta1_Sort" AllowSorting="true"
y la creación de las columnas :
...
Consulta1.Columns.Add(CreateBoundColumn("Fecha", "Fecha y hora"))
...
Function CreateBoundColumn(ByVal DataFieldValue As String, ByVal HeaderTextValue As String) As BoundColumn
' This version of CreateBoundColumn method sets only the
' DataField and HeaderText properties.
' Create a BoundColumn.
Dim column As BoundColumn = New BoundColumn
' Set the properties of the BoundColumn.
column.DataField = DataFieldValue
column.HeaderText = HeaderTextValue
column.SortExpression = DataFieldValue
Return column
End Function
funciona todo correctamente....

¿alguna pista?



Espero podais ayudarme. gracias
j@n