Hello Favia,

Take a look at these links:
http://forums.asp.net/p/1381476/2932831.aspx
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/98120f0e-ea28-4b47-b540-31938ddc53ad

I guess you'll have to do it programatically, so, these links bring you the
solutions. Since you're not generating the columns automatically, you have
to page and sort by your own.

If the links doesnt help you, start a search on google about "gridview
sorting programatically".

Best regards,
On Wed, Nov 4, 2009 at 9:16 AM, Alfaking <[email protected]> wrote:

>
> Hi all,
>
> I've created on a web page a gridview
> -----------------------------
> <asp:GridView ID="Elenco" runat="server" AllowSorting="True"
> AutoGenerateColumns="False" CssClass="Bordata" CellSpacing="2"
> CellPadding="5">
> <RowStyle CssClass="TabellaRiga" />
> <Columns>
> <asp:CommandField ButtonType="Image" EditImageUrl="~/risorse/
> modifica.png" HeaderText="Modifica" ShowEditButton="True"/>
> <asp:BoundField DataField="Id" HeaderText="Id" Visible="true"
> ItemStyle-Width="10px" SortExpression ="Id" >
> <ItemStyle Width="10px"></ItemStyle></asp:BoundField>
> <asp:BoundField DataField="UserId" HeaderText="Utente" SortExpression
> ="UserId"/>
> <asp:BoundField DataField="Cognome" HeaderText="Cognome"
> SortExpression ="Cognome"/>
> <asp:BoundField DataField="Nome" HeaderText="Nome" SortExpression
> ="Nome"/>
> <asp:BoundField DataField="eMail" HeaderText="E-Mail" SortExpression
> ="eMail"/>
> <asp:TemplateField HeaderText="Elimina">
> <ItemTemplate>
> <asp:ImageButton ID="DeleteButton" ImageUrl="~/risorse/elimina.png"
> CommandName="Delete" AlternateText="Cancella questo record"
> OnClientClick="return confirm('Sei sicuro di voler cancellare questo
> record?');" runat="server" />
> </ItemTemplate>
> </asp:TemplateField>
> </Columns>
> <HeaderStyle CssClass="TabellaTitolo" HorizontalAlign="Center" />
> <AlternatingRowStyle CssClass="TabellaRigaAlt" />
> </asp:GridView>
> -----------------------------
> and here I populate this gridview
> -----------------------------
>  Dim DS As DataSet
>
>  DS = Ser.getUtenti("U")
>
>  If Glb.checkDS(DS, Me.GetType.FullName, vErrDes, vErrSys) > 0 Then
>
>      Me.Elenco.DataSource = DS.Tables("Dati")
>      Me.Elenco.DataBind()
>
>  End If
>  DS = Nothing
>
> Exit Sub
> -------------------------------
> now, the header labels appears like hyperlinks, but the sorting is not
> working.
> I guess is because of the DataBinding...
>
> can anyone help me please ?
>



-- 
Atenciosamente,
Paulo Roberto S. Pellucci

Reply via email to