Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 682
  • Last Modified:

Sort & page on custom Gridview itemtemplate?

Hi,
How do i enable the sort and paging if i were to use a customize itemtemplate on a gridview?

Basically i'm putting few information into 1 column, rather than each info on each column as what a default gridview will do (thus the customize itemtemplate). But i just couldn't find a way to enable the paging or sorting.

Any help is greatly appreciated.

PS: Rather than calling the sqldatasource in the gridview web control, i programmatically databind the gridview - datatable.


.aspx page
==========
        <asp:GridView ID="gvwAllMenu" runat="server" AutoGenerateColumns="false" AllowSorting="true" >
            <Columns>
                <asp:BoundField HeaderText="ID" DataField='<%#Eval("menu_info_id")%>' />
                <asp:TemplateField>
                    <HeaderTemplate>
                        Market Place
                    </HeaderTemplate>
                    <ItemTemplate>
                    <table>
                        <tr>
                            <td><%#Eval("menu_info_id")%></td>
                            <td>
                                <%#Eval("title")%><br />
                                <i><%#Eval("summary")%></i>
                            </td>
                        </tr>
                        <tr>
                            <td><%#Eval("created_date")%></td><td> | <%#Eval("created_by")%></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:LinkButton ID="btnView" runat="server" Text="View" 
                                            CommandArgument='<%#Eval("menu_info_id")%>'
                                            CommandName="view" />
                            </td>
                        </tr>
                    </table>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
 
.aspx.vb page
==============
                gvwAllMenu.AllowSorting = True
                gvwAllMenu.AllowPaging = True
                gvwAllMenu.PageSize = 10
 
                gvwAllMenu.DataSource = objPublicUser.MenuAll()   'Connect to store procedure
                gvwAllMenu.DataBind()

Open in new window

0
tangteng78
Asked:
tangteng78
1 Solution
 
tangteng78Author Commented:
Btw,  some typo here. Paging is working fine...but i can't get the sorting to work.

PS: The header is not even underline to be clicked on.
0
 
CodeCruiserCommented:
I think you have to provide custom sorting in this scenario.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now