【发布时间】:2017-08-14 08:28:09
【问题描述】:
我有一个要求,我需要使用控件创建动态行,为此我使用了 gridview。问题是我无法在行之间显示黑色水平线。
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>
【问题讨论】:
标签: c# html css asp.net gridview