Solved

Sort & page on custom Gridview itemtemplate?

Posted on 2009-05-19
2
679 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

617 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