VS2003 DataGrid 资料行设定

拉DataGrid,命名为DataGrid1
建立col ,在DataGrid按右键,点选属性产生器
http://img2.58codes.com/2024/20106764Bwv5tgRzug.png

方法1:勾选 于执行阶段时自动建立资料行
http://img2.58codes.com/2024/201067647uK8TwsW3j.png

方法2:自行建立资料行
http://img2.58codes.com/2024/20106764SjECnKbjpp.png

页首文字
我在底线上面(我在底线下面)

产生的程式码会长这样

        <asp:label id="lblPROGNAME" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 16px"            runat="server" Width="1400" ForeColor="Red" Font-Size="X-Small" Height="8px">程式名称</asp:label><asp:datagrid id="DataGrid1" style="Z-INDEX: 103; LEFT: 8px; POSITION: absolute; TOP: 232px" runat="server"            Width="1700px" Height="336px" BackColor="White" BorderColor="#CCCCCC" AutoGenerateColumns="False" BorderStyle="None" BorderWidth="1px" CellPadding="3" Visible="False">            <FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>            <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle>            <ItemStyle ForeColor="#000066"></ItemStyle>            <HeaderStyle Font-Size="9pt" Font-Bold="True" HorizontalAlign="Center" ForeColor="White" BackColor="#006699"></HeaderStyle>            <Columns>                <asp:BoundColumn DataField="DT" HeaderText="库存日期">                    <HeaderStyle Width="3%"></HeaderStyle>                    <ItemStyle Font-Size="9pt" HorizontalAlign="Center"></ItemStyle>                </asp:BoundColumn>             </Columns>            <PagerStyle HorizontalAlign="Left" ForeColor="#000066" BackColor="White" Mode="NumericPages"></PagerStyle>        </asp:datagrid>

设定好GridView的资料行后,把datatable指给datagrid

this.DataGrid1.DataSource=dataTable;  this.DataGrid1.DataBind();

数字格式化

DataFormatString="{0:#,###}"


关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章