gpt4 book ai didi

c# - asp gridview中需要加一条横线来划分行

转载 作者:行者123 更新时间:2023-11-28 15:44:49 25 4
gpt4 key购买 nike

我有一个要求,我需要使用控件创建动态行,为此我使用了 gridview。问题是我无法在行之间显示黑色水平线。

要求: enter image description here

我的设计: enter image description here

CSS:

.alternateStyler {
margin-top:2px; // just wanted to see if it works, did not work though.
}

代码:

<asp:GridView ID="gvDelayIssueRisk" Width="98%" CssClass="labels" runat="server" ShowFooter="true" AutoGenerateColumns="false"
Style="margin-left: auto; margin-right: auto;"
OnSelectedIndexChanging="gvDelayIssueRisk_SelectedIndexChanging"
OnRowDataBound="gvDelayIssueRisk_RowDataBound"
AlternatingRowStyle-CssClass="alternateStyler">
<Columns>
<%-- <asp:BoundField DataField="noteid" HeaderText="ID" />--%>
<asp:TemplateField HeaderText="Type" ItemStyle-Width="10%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign ="Top">
<ItemTemplate>
<asp:Label ID="lblType" runat="server" Text='<%# Eval("Author") %>' Visible="false" />
<asp:DropDownList ID="ddlType" Width="98%" runat="server" CssClass="DropDownListStyle"></asp:DropDownList>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlType2" Width="98%" runat="server" CssClass="DropDownListStyle"></asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Impact" ItemStyle-Width="10%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign ="Top">
<ItemTemplate>
<asp:Label ID="lblImpact" runat="server" Text='<%# Eval("Author") %>' Visible="false" />
<asp:DropDownList ID="ddlImpact" Width="98%" runat="server" CssClass="DropDownListStyle"></asp:DropDownList>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlImpact2" Width="98%" runat="server" CssClass="DropDownListStyle"></asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DIR Description" ItemStyle-Width="20%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign ="Top">
<ItemTemplate>
<asp:TextBox ID="txtDIRDesc" Width="98%" TextMode="MultiLine" Height="100px" runat="server" Text='<%# Eval("notes")%>'></asp:TextBox>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtDIRDesc2" Width="98%" TextMode="MultiLine" Height="100px" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Remediation Plan" ItemStyle-Width="20%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign ="Top">
<ItemTemplate>
<asp:TextBox ID="txtRemPlan" Width="98%" TextMode="MultiLine" Height="100px" runat="server" Text='<%# Eval("notes")%>'></asp:TextBox>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtRemPlan2" Width="98%" TextMode="MultiLine" Height="100px" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Owner" ItemStyle-Width="10%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign ="Top">
<ItemTemplate>
<asp:TextBox ID="txtOwner" Width="98%" runat="server" Text='<%# Eval("notes")%>'></asp:TextBox>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtOwner2" Width="98%" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Due Date" ItemStyle-Width="8%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign ="Top">
<ItemTemplate>
<asp:TextBox ID="dtDueDate" CssClass="Datetext" Width="98%" runat="server" Text='<%# Eval("DateAdded")%>'></asp:TextBox>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="dtDueDate2" CssClass="Datetext" Width="98%" runat="server">
</asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Complete Date" ItemStyle-Width="8%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign ="Top">
<ItemTemplate>
<asp:TextBox ID="dtCompleteDate" CssClass="Datetext" Width="98%" runat="server" Text='<%# Eval("DateAdded")%>'></asp:TextBox>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="dtCompleteDate2" CssClass="Datetext" Width="98%" runat="server">
</asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Notes" ItemStyle-Width="20%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign ="Top">
<ItemTemplate>
<asp:TextBox ID="txtDelayNotes" Width="98%" TextMode="MultiLine" Height="100px" runat="server" Text='<%# Eval("notes")%>'></asp:TextBox>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtDelayNotes2" Width="98%" TextMode="MultiLine" Height="100px" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

最佳答案

ItemStyle-CssClass 添加到网格中的每个 TemplateField

<asp:TemplateField HeaderText="Type" ItemStyle-CssClass="someClass"  ItemStyle-Width="10%" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign ="Top">...

someClass 规则的定义应该是这样的:

<style type="text/css">
.someClass
{
border-bottom:solid 1px black;
}
</style>

关于c# - asp gridview中需要加一条横线来划分行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42948016/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com