?
Solved

Sort & page on custom Gridview itemtemplate?

Posted on 2009-05-19
2
Medium Priority
?
681 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 1500 total points
ID: 24648210
I think you have to provide custom sorting in this scenario.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

719 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