gridview里的格式问题

    技术2022-06-08  44

    时间:<asp:BoundField DataField="加油时间" HeaderText="加油时间" DataFormatString="{0:yyyy-MM-dd}"/>

     

    金钱:

      <asp:TemplateField HeaderText="累计充值金额">                                                    <ItemTemplate>                                                        <%#Eval("金额").ToString() == "" ? "0" : Convert.ToDecimal(Eval("金额")).ToString("C")%>                                                    </ItemTemplate>                                                </asp:TemplateField>

     

    数位大于20的用省略号:                                    <asp:TemplateField HeaderText="办卡地点">                                        <ItemTemplate>                                            <asp:Label ID="lbl_address" runat="server" Text='<%# Eval("办卡地点").ToString().Length > 20 ? Eval("办卡地点").ToString().Substring(0, 20) +"...": Eval("办卡地点").ToString() %>'>'></asp:Label>                                        </ItemTemplate>                                    </asp:TemplateField>


    最新回复(0)