Solved

Sort & page on custom Gridview itemtemplate?

Posted on 2009-05-19
2
672 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
Comment Utility
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
Comment Utility
I think you have to provide custom sorting in this scenario.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now