GridView帮定数据显示数据的技巧

<asp:GridView ID="grdList" runat="server" AutoGenerateColumns="False" Width="100%"
        DataKeyNames="SalesOrderId" OnRowDataBound="grdList_RowDataBound" AllowPaging="True" PageSize="50" OnPageIndexChanging="grdList_PageIndexChanging">
        <Columns>
         <asp:HyperLinkField Target="_blank" DataTextField="SalesNum" HeaderText="订单编号">
          <HeaderStyle Width="60px" />
         </asp:HyperLinkField>
         <asp:BoundField HeaderText="订单状态" DataField="StateName">
          <HeaderStyle Width="60px" />
         </asp:BoundField>
         <asp:BoundField HeaderText="客户编号" DataField="CustomerNum">
          <HeaderStyle Width="60px" />
         </asp:BoundField>
         <asp:BoundField HeaderText="姓名" DataField="Consignee">
          <HeaderStyle Width="60px" />
         </asp:BoundField>
         <asp:TemplateField HeaderText="电话">
          <ItemTemplate>
           <asp:LinkButton ID="lkTel" runat="server" Text="******"></asp:LinkButton>
          </ItemTemplate>
                                        <ControlStyle Width="60px" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="手机">
          <ItemTemplate>
           <asp:LinkButton ID="lkMob" runat="server" Text='******'></asp:LinkButton>
          </ItemTemplate>
                                        <ControlStyle Width="60px" />
         </asp:TemplateField>
         <asp:BoundField HeaderText="送货地址" DataField="Address">
                                        <ControlStyle Width="50%" />
                                        <ItemStyle CssClass="gvAddress" />
         </asp:BoundField>
         <asp:BoundField HeaderText="总金额" DataField="Amount" DataFormatString="{0:N2}">
          
                                        <ItemStyle CssClass="gvAmount" />
         </asp:BoundField>
         <asp:BoundField HeaderText="受理人" DataField="AcceptName">
          <HeaderStyle Width="45px" />
         </asp:BoundField>
         <asp:BoundField HeaderText="订购日期" DataField="SalesDate" DataFormatString="{0:yyyy-MM-dd}">
          <HeaderStyle Width="80px" />
         </asp:BoundField>
         <asp:TemplateField HeaderText="操作">
          <ItemTemplate>
           <asp:HyperLink ID="HyperLink1" NavigateUrl='<%#"SalesEdit.aspx?id=" + Eval("SalesOrderId") %>'
            Target="_blank" runat="server">编辑</asp:HyperLink>
          </ItemTemplate>
                                        <ControlStyle Width="30px" />
         </asp:TemplateField>
        </Columns>
        <RowStyle CssClass="gvRow" BackColor="White" />
        <HeaderStyle CssClass="gvHeader" />
        <AlternatingRowStyle CssClass="gvAlternatingRow" BackColor="#F4F4F4" />
        
                                <PagerSettings PageButtonCount="30" />
       </asp:GridView>

你可能感兴趣的:(GridView)