网格视图SortExpression无法正常工作 [英] Grid view SortExpression not working

查看:110
本文介绍了网格视图SortExpression无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码SortExpression有效,但是当以另一种方式编写时,它不起作用.显示以下代码.

This code SortExpression working but when be write it another way it is not work. code below are show.

<asp:BoundField DataField="RemainingPairs" HeaderText="Remaining" ItemStyle-CssClass="GridContent"
                                    DataFormatString="{0:#,###}" HeaderStyle-Width="30px" ItemStyle-Width="30px"
                                    HeaderStyle-CssClass="GridHeader" HeaderStyle-Wrap="true" ItemStyle-HorizontalAlign="Right"
 SortExpression="Remaining_Pairs" FooterText="asdf" />



第二个代码.



Second code.

<asp:TemplateField ItemStyle-HorizontalAlign="Right" SortExpression="Remaining_Pairs"

                                    HeaderStyle-CssClass="GridHeader" HeaderStyle-Wrap="true" HeaderStyle-Width="30px"

                                    ItemStyle-Width="30px" ItemStyle-CssClass="GridContent">
                                    <HeaderTemplate>
                                        Remaining
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblRemainingPairs" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "RemainingPairs")%>'></asp:Label>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        <asp:Label runat="server" ID="lblTotalRemaingPaires" Text=""></asp:Label>
                                    </FooterTemplate>
                                    <ItemStyle HorizontalAlign="Right" />
                                    <FooterStyle HorizontalAlign="Right" />
                                </asp:TemplateField>


它不起作用.
请帮助..


its not working.
Please help..

推荐答案

SortExpression ="Remaining_Pairs"
Text =''<%#DataBinder.Eval(Container.DataItem,"RemainingPairs")%>''''

必须为exp排序中的RemainingPairs.

else删除标题模板,并在模板字段中分配标题文本.
SortExpression="Remaining_Pairs"
Text=''<%#DataBinder.Eval(Container.DataItem, "RemainingPairs")%>''

It needs to be RemainingPairs in the sort exp.

else Remove header template and assign header text instead in template field.


这篇关于网格视图SortExpression无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆