Solved

Sort & page on custom Gridview itemtemplate?

Posted on 2009-05-19
2
674 Views
Last Modified: 2013-12-17
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
Comment
Question by:tangteng78
2 Comments
 

Author Comment

by:tangteng78
ID: 24424430
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
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 24648210
I think you have to provide custom sorting in this scenario.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Alert on Server memory 2 24
VB.NET 1 24
Help with preventing downloading a zip file 10 37
How come this regular expression allows "e"? 14 38
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question