代码人生的小狗窝

一行行枯燥的代码,却描绘出人生的点点滴滴

您现在的位置是:首页>_C#

如何设置gridview的标题

发布时间:2019-08-17浏览(1122)

    怎么设置gridview的标题
    谢谢大家了

    ------解决方案--------------------
    Caption或自己整个 <headerTemplate
    ------解决方案--------------------
    up
    ------解决方案--------------------
    http://dotnet.aspx.cc/article/d00bb0f8-ce58-4e0d-953c-dbe243be4f2c/read.aspx
    ------解决方案--------------------
    1 sql中设置 select yhm as 用户名 from tbUser
    2 <asp:BoundField DataField= "XXX " HeaderText= "用户名 " />
    3 <asp:TemplateField HeaderText= "用户名 " >
    <ItemTemplate>
    <asp:Label ID= "Label1 " runat= "server " Text= ' <%# Eval( "XXX ") %> '> </asp:Label>
    </ItemTemplate>
    </asp:TemplateField>
    这种可以往里扔控件
    ------解决方案--------------------
    Caption
    ------解决方案--------------------
    一个datagrid 拿去学吧

    <TD colSpan= "4 "> <asp:datagrid id= "DGR_Master " runat= "server " Height= "200px " Width= "656px " BorderStyle= "None " BackColor= "White "
    BorderWidth= "1px " BorderColor= "#CCCCCC " DataKeyField= "TC_ID " AllowPaging= "True " CellPadding= "3 " AutoGenerateColumns= "False "
    HorizontalAlign= "Left " PageSize= "6 ">
    <AlternatingItemStyle BackColor= "#EEEEEE "> </AlternatingItemStyle>
    <ItemStyle Font-Size= "9pt " Font-Names= "Arial " HorizontalAlign= "Left " Height= "25px " ForeColor= "#000066 "> </ItemStyle>
    <HeaderStyle Font-Size= "10pt " Font-Names= "Arial " Font-Bold= "True " HorizontalAlign= "Left " Height= "25px "
    ForeColor= "White " BorderColor= "White " BackColor= "#006699 "> </HeaderStyle>
    <FooterStyle Height= "20px " ForeColor= "#000066 " BackColor= "White "> </FooterStyle>
    <Columns>
    <asp:TemplateColumn>
    <HeaderTemplate>
    <b> 日付(yyyy/mm/dd) </b>
    </HeaderTemplate>
    <ItemTemplate>
    <asp:Label Height= "20px " Width = "15px " Text= ' <%# DataBinder.Eval(Container.DataItem, "TC_Date ").ToString().Trim() %> ' runat= "server " ID= "Lab_T_Num "/>
    </ItemTemplate>
    <EditItemTemplate>
    <asp:TextBox MaxLength= "4 " Text= ' <%# DataBinder.Eval(Container.DataItem, "TC_Date ").ToString().Trim() %> ' runat= "server " Width= "120px " style= "IME-MODE: disabled " id= "Txt_TC_Date "/>
    </EditItemTemplate>
    </asp:TemplateColumn>
    <asp:TemplateColumn>
    <HeaderTemplate>
    <b> テスト工数(1h単位) </b>
    </HeaderTemplate>
    <ItemTemplate>
    <asp:Label Height= "20px " width= "50px " Text= ' <%# DataBinder.Eval(Container.DataItem, "TC_TestDay ").ToString().Trim() %> ' runat= "server " ID= "Lab__TestDay "/>
    </ItemTemplate>