我使用两个FormViews
来插入和更新数据。我想删除这两个FormViews
之间的空格。我怎样才能做到这一点?
我可以使用CSS类删除该空间吗?
请帮忙。
谢谢&问候,Mayur。
这是Html代码:
<table class="fv">
<tr>
<td colspan="2" class="style12"><b>Select Subscriber</b></td><td class="td" colspan="2" align="right"> * Required Field</td>
</tr>
<tr>
<td class="style5"></td><td class="style14"></td>
</tr>
</table>
<table class="fv" width="100%" >
<tr>
<td class="style15">
<b>
<asp:Label ID="Label5" runat="server" Text="District:"></asp:Label></b>
</td>
<td class="style1">
<asp:DropDownList ID="ddldistrict" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource4"
DataTextField="district_name" OnSelectedIndexChanged="ddldistrict_SelectedIndexChanged"
DataValueField="district_id" Width="150px">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:EBPConnectionString1 %>"
SelectCommand="SELECT [district_name], [district_id] FROM [districts_mst] WHERE (([lang_id] = @lang_id) AND ([state_id] = @state_id))">
<SelectParameters>
<asp:Parameter DefaultValue="2" Name="lang_id" Type="Int64" />
<asp:Parameter DefaultValue="35" Name="state_id" Type="Int64" />
</SelectParameters>
</asp:SqlDataSource>
</td>
<td class="style2">
<b>
<asp:Label ID="lblSubId" runat="server" Text="Subscriber Id:"></asp:Label></b>
</td>
<td>
<asp:DropDownList ID="ddlSub" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3"
DataTextField="SubId" OnSelectedIndexChanged="ddlSub_SelectedIndexChanged" DataValueField="SubId"
Width="150px" OnDataBound="MyListDataBound">
<asp:ListItem Value="0">--Select--</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:EBPConnectionString1 %>"
SelectCommand="SELECT [SubId], [Ser] FROM [Subsciber] WHERE ([District] = @District)">
<SelectParameters>
<asp:ControlParameter ControlID="ddldistrict" Name="District" PropertyName="SelectedValue"
Type="Int64" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
</table>
<table width="999px" style="margin-right: 0px">
<tr>
<td class="style12"><b>Subscriber Information</b></td>
</tr>
<tr>
<td class="style13"></td>
</tr>
</table>
<asp:FormView ID="FV" runat="server" Width="999px" DataSourceID="SqlDataSource2"
CssClass="fv">
<EditItemTemplate>
<table>
<tr>
<td>
<b>
<asp:Label ID="lblSubId" runat="server" Text="Subscriber Id:"></asp:Label></b>
</td>
<td>
<asp:Label ID="SubIdLabel" runat="server" Text='<%# Bind("SubId") %>' />
</td>
<td>
<b>
<asp:Label ID="lblFName" runat="server" Text="Name:"></asp:Label></b>
</td>
<td>
<asp:Label ID="NameLabel" runat="server" Text='<%# Bind("FName") %>' />
</td>
<td>
<b>
<asp:Label ID="lblAdd" runat="server" Text="Address:"></asp:Label></b>
</td>
<td>
<asp:Label ID="AddressLabel" runat="server" Text='<%# Bind("Address") %>' />
</td>
<td>
<b>
<asp:Label ID="lblState" runat="server" Text="State:"></asp:Label>
</b>
</td>
<td>
<asp:Label ID="state_nameLabel" runat="server" Text='<%# Bind("state_name") %>' />
</td>
</tr>
<tr>
<td>
<b>
<asp:Label ID="lblDist" runat="server" Text="District:"></asp:Label>
</b>
</td>
<td>
<asp:Label ID="district_nameLabel" runat="server" Text='<%# Bind("district_name") %>' />
</td>
<td>
<b>
<asp:Label ID="lbltaluka" runat="server" Text="Taluka:"></asp:Label>
</b>
</td>
<td>
<asp:Label ID="taluka_nameLabel" runat="server" Text='<%# Bind("taluka_name") %>' />
</td>
<td>
<b>
<asp:Label runat="server" Text="Pincode:"></asp:Label>
</b>
</td>
<td>
<asp:Label ID="pincodeLabel" runat="server" Text='<%# Bind("pincode") %>' />
</td>
<td>
<b>
<asp:Label runat="server" Text="Telephone No:"></asp:Label>
</b>
</td>
<td>
<asp:Label ID="TelNoLabel" runat="server" Text='<%# Bind("TelNo") %>' />
</td>
</tr>
</table>
</EditItemTemplate>
<InsertItemTemplate>
<table>
<tr>
<td>
<asp:Label ID="lblSubId" runat="server" Text="Subscriber Id:"></asp:Label>
</td>
<td>
<asp:TextBox ID="SubIdLabel" runat="server" Text='<%# Bind("SubId") %>' />
</td>
<td>
<asp:Label ID="lblFName" runat="server" Text="Name:"></asp:Label>
</td>
<td>
<asp:TextBox ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
</td>
<td>
<asp:Label ID="lblAdd" runat="server" Text="Address:"></asp:Label>
</td>
<td>
<asp:TextBox ID="AddressLabel" runat="server" Text='<%# Bind("Address") %>' />
</td>
<td>
<asp:Label ID="lblState" runat="server" Text="State:"></asp:Label>
</td>
<td>
<asp:TextBox ID="state_nameLabel" runat="server" Text='<%# Bind("state_name") %>' />
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblDist" runat="server" Text="District:"></asp:Label>
</td>
<td>
<asp:TextBox ID="district_nameLabel" runat="server" Text='<%# Bind("district_name") %>' />
</td>
<td>
<asp:Label ID="lbltaluka" runat="server" Text="Taluka:"></asp:Label>
</td>
<td>
<asp:TextBox ID="taluka_nameLabel" runat="server" Text='<%# Bind("taluka_name") %>' />
</td>
<td>
<asp:Label ID="Label1" runat="server" Text="Pincode:"></asp:Label>
</td>
<td>
<asp:TextBox ID="pincodeLabel" runat="server" Text='<%# Bind("pincode") %>' />
</td>
<td>
<asp:Label ID="Label2" runat="server" Text="Telephone No:"></asp:Label>
</td>
<td>
<asp:TextBox ID="TelNoLabel" runat="server" Text='<%# Bind("TelNo") %>' />
</td>
</tr>
</table>
</InsertItemTemplate>
<ItemTemplate>
<table>
<tr>
<td>
<b>
<asp:Label ID="lblSubId" runat="server" Text="Id:"></asp:Label>
</b>
</td>
<td class="style16">
<asp:Label ID="SubIdLabel" runat="server" Text='<%# Bind("SubId") %>' />
</td>
<td>
<b>
<asp:Label ID="lblFName" runat="server" Text="Name:"></asp:Label>
</b>
</td>
<td class="style17">
<asp:Label ID="NameLabel" runat="server" Width="150px" Text='<%# Bind("Name") %>' />
</td>
<td>
<b>
<asp:Label ID="lblAdd" runat="server" Text="Address:"></asp:Label>
</b>
</td>
<td>
<asp:Label ID="AddressLabel" runat="server" Width="200px" Text='<%# Bind("Address") %>' />
</td>
<td>
<b>
<asp:Label ID="lblState" runat="server" Text="State:"></asp:Label>
</b>
</td>
<td>
<asp:Label ID="state_nameLabel" runat="server" Text='<%# Bind("state_name") %>' />
</td>
</tr>
<tr>
<td>
<b>
<asp:Label ID="lblDist" runat="server" Text="District:"></asp:Label>
</b>
</td>
<td class="style16">
<asp:Label ID="district_nameLabel" runat="server" Text='<%# Bind("district_name") %>' />
</td>
<td>
<b>
<asp:Label ID="lbltaluka" runat="server" Text="Taluka:"></asp:Label>
</b>
</td>
<td class="style17">
<asp:Label ID="taluka_nameLabel" runat="server" Text='<%# Bind("taluka_name") %>' />
</td>
<td>
<b>
<asp:Label ID="Label3" runat="server" Text="Pincode:"></asp:Label>
</b>
</td>
<td>
<asp:Label ID="pincodeLabel" runat="server" Text='<%# Bind("pincode") %>' />
</td>
<td>
<b>
<asp:Label ID="Label4" runat="server" Text="Telephone No:"></asp:Label>
</b>
</td>
<td>
<asp:Label ID="TelNoLabel" runat="server" Text='<%# Bind("TelNo") %>' />
</td>
</tr>
<tr>
<%-- <td>
<b> <asp:Label ID="Label5" runat="server" Text="Magazine name:"></asp:Label> </b>
</td>
<td>
<asp:Label ID="Label6" runat="server" Text='<%# Bind("Magid") %>' />
</td>
<td>
<b> <asp:Label ID="Label7" runat="server" Text="Subscription Period:"></asp:Label> </b>
</td>
<td>
<asp:Label ID="Label8" runat="server" Text='<%# Bind("Period") %>'/> <asp:Label runat="server" text="years"></asp:Label>
</td>--%>
</tr>
</table>
</ItemTemplate>
</asp:FormView>
<table width="999px">
<tr>
<td class="style12"><b>Magazine Information</b></td>
</tr>
<tr>
<td class="style13"></td>
</tr>
</table>
<asp:FormView ID="FV1" runat="server" DataSourceID="SqlDataSource1" Width="999px"
DefaultMode="Edit" CssClass="fv">
<EditItemTemplate>
<table>
<tr>
<td>
<asp:Label runat="server" Text="Magazine Name:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlMagazine" runat="server" SelectedValue='<%# Bind("MagId") %>'
DataTextField="name" DataValueField="magid" DataSourceID="SqlDataSource1" AutoPostBack="true"
OnSelectedIndexChanged="ddlMagazine_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td>
<asp:Label runat="server" Text="Price:"></asp:Label>
</td>
<td>
<asp:TextBox ID="PriceLabel" runat="server" Text='<%# Bind("Price") %>' Enabled="false" />
</td>
<td>
<asp:Label runat="server" Text="Period:"></asp:Label>
</td>
<td>
<asp:TextBox ID="PeriodLabel" runat="server" Text='<%# Bind("Period") %>' Enabled="false" />
</td>
<td>
<asp:Label runat="server" Text="Subscription Period:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlSubPeriod" runat="server" DataTextField="period" DataValueField="period"
AutoPostBack="true" OnSelectedIndexChanged="ddlSubPeriod_SelectedIndexChanged">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
</asp:DropDownList>
</td>
<td>
<asp:Label runat="server" Text="Amount:"></asp:Label>
</td>
<td>
<asp:TextBox ID="amountLabel" runat="server" Enabled="false" />
</td>
</tr>
</table>
</EditItemTemplate>
<InsertItemTemplate>
<table>
<tr>
<td>
Name:
<asp:DropDownList ID="ddlMagazine" runat="server" SelectedValue='<%# Bind("MagId") %>'
DataTextField="name" DataValueField="magid" DataSourceID="SqlDataSource1" AutoPostBack="true">
</asp:DropDownList>
</td>
<td>
Price:
<asp:TextBox ID="PriceLabel" runat="server" Text='<%# Bind("Price") %>' Enabled="false" />
</td>
<td>
Period:
<asp:TextBox ID="PeriodLabel" runat="server" Text='<%# Bind("Period") %>' Enabled="false" />
</td>
<td>
Qty:
<asp:TextBox ID="txtQuantity" runat="server" Text='<%# Bind("Qty") %>' OnTextChanged="txtQuantity_TextChanged" />
</td>
<td>
Amount:
<asp:TextBox ID="amountLabel" runat="server" Text='<%# Bind("amount") %>' Enabled="false" />
</td>
</tr>
</table>
</InsertItemTemplate>
<ItemTemplate>
<table>
<tr>
<td>
Name:
<asp:DropDownList ID="ddlMagazine" runat="server" SelectedValue='<%# Bind("MagId") %>'
DataTextField="name" DataValueField="magid" DataSourceID="SqlDataSource1" AutoPostBack="true">
</asp:DropDownList>
</td>
<td>
Price:
<asp:Label ID="PriceLabel" runat="server" Text='<%# Bind("Price") %>' />
</td>
<td>
Period:
<asp:Label ID="PeriodLabel" runat="server" Text='<%# Bind("Period") %>' />
</td>
<td>
Qty:
<asp:TextBox ID="txtQuantity" runat="server" Text='<%# Bind("Qty") %>' OnTextChanged="txtQuantity_TextChanged" />
</td>
<td>
Amount:
<asp:Label ID="amountLabel" runat="server" Text='<%# Bind("amount") %>' />
</td>
</tr>
</table>
</ItemTemplate>
</asp:FormView>
答案 0 :(得分:1)
确保您可以使用CSS精确地自定义表单的外观。
考虑删除任何边距,填充,顶部/底部值,或者只是将它们重置为零