Solved

Sort & page on custom Gridview itemtemplate?

Posted on 2009-05-19
2
678 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

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

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

738 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