列表视图项之间的空格
本文关键字:空格 之间 视图 列表 | 更新日期: 2023-09-27 17:56:44
我有一个连接到sqlserver的列表视图,但列表视图的列之间没有任何空格。我想在我的列表视图中添加表格中的单元格填充等功能。我的代码 :
<asp:ListView ID="ListView1" runat="server" DataKeyNames="DarkhastId"
DataSourceID="SqlDataSource1" GroupItemCount="2">
<AlternatingItemTemplate>
<td runat="server" style="">
DarkhastId:
<asp:Label ID="DarkhastIdLabel" runat="server"
Text='<%# Eval("DarkhastId") %>' />
<br />
shakhs:
<asp:Label ID="shakhsLabel" runat="server" Text='<%# Eval("shakhs") %>' />
<br />
nam:
<asp:Label ID="namLabel" runat="server" Text='<%# Eval("nam") %>' />
<br />
Idgharardad:
<asp:Label ID="IdgharardadLabel" runat="server"
Text='<%# Eval("Idgharardad") %>' />
<br />
elat:
<asp:Label ID="elatLabel" runat="server" Text='<%# Eval("elat") %>' />
<br />
hamrah:
<asp:Label ID="hamrahLabel" runat="server" Text='<%# Eval("hamrah") %>' />
<br />
sabet:
<asp:Label ID="sabetLabel" runat="server" Text='<%# Eval("sabet") %>' />
<br />
vaziat:
<asp:Label ID="vaziatLabel" runat="server" Text='<%# Eval("vaziat") %>' />
<br />
karshenas:
<asp:Label ID="karshenasLabel" runat="server" Text='<%# Eval("karshenas") %>' />
<br />
tarikh:
<asp:Label ID="tarikhLabel" runat="server" Text='<%# Eval("tarikh") %>' />
<br />
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"
Text="Delete" />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<br />
</td>
</AlternatingItemTemplate>
<EditItemTemplate>
<td runat="server" style="">
DarkhastId:
<asp:Label ID="DarkhastIdLabel1" runat="server"
Text='<%# Eval("DarkhastId") %>' />
<br />
shakhs:
<asp:TextBox ID="shakhsTextBox" runat="server" Text='<%# Bind("shakhs") %>' />
<br />
nam:
<asp:TextBox ID="namTextBox" runat="server" Text='<%# Bind("nam") %>' />
<br />
Idgharardad:
<asp:TextBox ID="IdgharardadTextBox" runat="server"
Text='<%# Bind("Idgharardad") %>' />
<br />
elat:
<asp:TextBox ID="elatTextBox" runat="server" Text='<%# Bind("elat") %>' />
<br />
hamrah:
<asp:TextBox ID="hamrahTextBox" runat="server" Text='<%# Bind("hamrah") %>' />
<br />
sabet:
<asp:TextBox ID="sabetTextBox" runat="server" Text='<%# Bind("sabet") %>' />
<br />
vaziat:
<asp:TextBox ID="vaziatTextBox" runat="server" Text='<%# Bind("vaziat") %>' />
<br />
karshenas:
<asp:TextBox ID="karshenasTextBox" runat="server"
Text='<%# Bind("karshenas") %>' />
<br />
tarikh:
<asp:TextBox ID="tarikhTextBox" runat="server" Text='<%# Bind("tarikh") %>' />
<br />
<asp:Button ID="UpdateButton" runat="server" CommandName="Update"
Text="Update" />
<br />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Cancel" />
<br />
</td>
</EditItemTemplate>
<EmptyDataTemplate>
<table runat="server" style="">
<tr>
<td>
No data was returned.</td>
</tr>
</table>
</EmptyDataTemplate>
<EmptyItemTemplate>
<td runat="server" />
</EmptyItemTemplate>
<GroupTemplate>
<tr ID="itemPlaceholderContainer" runat="server">
<td ID="itemPlaceholder" runat="server">
</td>
</tr>
</GroupTemplate>
<InsertItemTemplate>
<td runat="server" style="">
shakhs:
<asp:TextBox ID="shakhsTextBox" runat="server" Text='<%# Bind("shakhs") %>' />
<br />
nam:
<asp:TextBox ID="namTextBox" runat="server" Text='<%# Bind("nam") %>' />
<br />
Idgharardad:
<asp:TextBox ID="IdgharardadTextBox" runat="server"
Text='<%# Bind("Idgharardad") %>' />
<br />
elat:
<asp:TextBox ID="elatTextBox" runat="server" Text='<%# Bind("elat") %>' />
<br />
hamrah:
<asp:TextBox ID="hamrahTextBox" runat="server" Text='<%# Bind("hamrah") %>' />
<br />
sabet:
<asp:TextBox ID="sabetTextBox" runat="server" Text='<%# Bind("sabet") %>' />
<br />
vaziat:
<asp:TextBox ID="vaziatTextBox" runat="server" Text='<%# Bind("vaziat") %>' />
<br />
karshenas:
<asp:TextBox ID="karshenasTextBox" runat="server"
Text='<%# Bind("karshenas") %>' />
<br />
tarikh:
<asp:TextBox ID="tarikhTextBox" runat="server" Text='<%# Bind("tarikh") %>' />
<br />
<asp:Button ID="InsertButton" runat="server" CommandName="Insert"
Text="Insert" />
<br />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Clear" />
<br />
</td>
</InsertItemTemplate>
<ItemTemplate>
<td runat="server" style="">
DarkhastId:
<asp:Label ID="DarkhastIdLabel" runat="server"
Text='<%# Eval("DarkhastId") %>' />
<br />
shakhs:
<asp:Label ID="shakhsLabel" runat="server" Text='<%# Eval("shakhs") %>' />
<br />
nam:
<asp:Label ID="namLabel" runat="server" Text='<%# Eval("nam") %>' />
<br />
Idgharardad:
<asp:Label ID="IdgharardadLabel" runat="server"
Text='<%# Eval("Idgharardad") %>' />
<br />
elat:
<asp:Label ID="elatLabel" runat="server" Text='<%# Eval("elat") %>' />
<br />
hamrah:
<asp:Label ID="hamrahLabel" runat="server" Text='<%# Eval("hamrah") %>' />
<br />
sabet:
<asp:Label ID="sabetLabel" runat="server" Text='<%# Eval("sabet") %>' />
<br />
vaziat:
<asp:Label ID="vaziatLabel" runat="server" Text='<%# Eval("vaziat") %>' />
<br />
karshenas:
<asp:Label ID="karshenasLabel" runat="server" Text='<%# Eval("karshenas") %>' />
<br />
tarikh:
<asp:Label ID="tarikhLabel" runat="server" Text='<%# Eval("tarikh") %>' />
<br />
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"
Text="Delete" />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<br />
</td>
</ItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table ID="groupPlaceholderContainer" runat="server" border="0" style="">
<tr ID="groupPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="">
<asp:DataPager ID="DataPager1" runat="server" PageSize="12">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<td runat="server" style="">
DarkhastId:
<asp:Label ID="DarkhastIdLabel" runat="server"
Text='<%# Eval("DarkhastId") %>' />
<br />
shakhs:
<asp:Label ID="shakhsLabel" runat="server" Text='<%# Eval("shakhs") %>' />
<br />
nam:
<asp:Label ID="namLabel" runat="server" Text='<%# Eval("nam") %>' />
<br />
Idgharardad:
<asp:Label ID="IdgharardadLabel" runat="server"
Text='<%# Eval("Idgharardad") %>' />
<br />
elat:
<asp:Label ID="elatLabel" runat="server" Text='<%# Eval("elat") %>' />
<br />
hamrah:
<asp:Label ID="hamrahLabel" runat="server" Text='<%# Eval("hamrah") %>' />
<br />
sabet:
<asp:Label ID="sabetLabel" runat="server" Text='<%# Eval("sabet") %>' />
<br />
vaziat:
<asp:Label ID="vaziatLabel" runat="server" Text='<%# Eval("vaziat") %>' />
<br />
karshenas:
<asp:Label ID="karshenasLabel" runat="server" Text='<%# Eval("karshenas") %>' />
<br />
tarikh:
<asp:Label ID="tarikhLabel" runat="server" Text='<%# Eval("tarikh") %>' />
<br />
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"
Text="Delete" />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<br />
</td>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:akhbarrrConnectionString %>"
DeleteCommand="DELETE FROM [darkhastezam] WHERE [DarkhastId] = @DarkhastId"
InsertCommand="INSERT INTO [darkhastezam] ([shakhs], [nam], [Idgharardad], [elat], [hamrah], [sabet], [vaziat], [karshenas], [tarikh]) VALUES (@shakhs, @nam, @Idgharardad, @elat, @hamrah, @sabet, @vaziat, @karshenas, @tarikh)"
SelectCommand="SELECT * FROM [darkhastezam]"
UpdateCommand="UPDATE [darkhastezam] SET [shakhs] = @shakhs, [nam] = @nam, [Idgharardad] = @Idgharardad, [elat] = @elat, [hamrah] = @hamrah, [sabet] = @sabet, [vaziat] = @vaziat, [karshenas] = @karshenas, [tarikh] = @tarikh WHERE [DarkhastId] = @DarkhastId">
<DeleteParameters>
<asp:Parameter Name="DarkhastId" Type="Decimal" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="shakhs" Type="String" />
<asp:Parameter Name="nam" Type="String" />
<asp:Parameter Name="Idgharardad" Type="Decimal" />
<asp:Parameter Name="elat" Type="String" />
<asp:Parameter Name="hamrah" Type="String" />
<asp:Parameter Name="sabet" Type="String" />
<asp:Parameter Name="vaziat" Type="String" />
<asp:Parameter Name="karshenas" Type="String" />
<asp:Parameter Name="tarikh" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="shakhs" Type="String" />
<asp:Parameter Name="nam" Type="String" />
<asp:Parameter Name="Idgharardad" Type="Decimal" />
<asp:Parameter Name="elat" Type="String" />
<asp:Parameter Name="hamrah" Type="String" />
<asp:Parameter Name="sabet" Type="String" />
<asp:Parameter Name="vaziat" Type="String" />
<asp:Parameter Name="karshenas" Type="String" />
<asp:Parameter Name="tarikh" Type="String" />
<asp:Parameter Name="DarkhastId" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>
</div>
您可以只添加单元格间距属性吗?
<LayoutTemplate>
<table runat="server" cellspacing="5">
我建议添加css样式:
例如,此项目,尽管这是用于按钮的:
<asp:Button ID="CancelButton" runat="server" style="padding:15px;" CommandName="Cancel" Text="Clear" />
另请参阅 CSS 类的 http://msdn.microsoft.com/en-us/library/9wx8w7we
- 将 CssClass 添加到所有表标记
<table class="test" ...
-
创建内联样式(或外部样式)。您可以将样式更改为符合您需求的边距或顶部填充/底部填充。
表.测试 TD { 填充:3px; }