我遇到Visual Studio或ASP.NET问题。我已经在html表中布置了控件,但是TextBox和DropDownList控件在表格中显得不合适,只是占据了屏幕的底部。
这里是标记,因为你可以看到文本框"应该"都属于这些要素:
<table>
<thead>
<tr>
<th colspan="6">
<asp:Label ID="Search_Header" runat="server" Font-Bold="True" meta:resourcekey="Search_HeaderResource1" Font-Size="16pt"></asp:Label>
</th>
</tr>
</thead>
<tbody class="controls">
<tr>
<td style="height: 22px">
<asp:Label ID="Destination" runat="server" meta:resourcekey="DestinationResource1" ></asp:Label>
</td>
<td style="height: 22px">
<asp:TextBox ID="Destination_Text" runat="server" meta:resourcekey="TextBox1Resource1"></asp:TextBox>
</td>
<td style="height: 22px">
<asp:Label ID="Check_In" runat="server" Text="Label" meta:resourcekey="Check_InResource1"></asp:Label>
</td>
<td style="height: 22px">
<asp:TextBox ID="Check_In_Date" runat="server" meta:resourcekey="Check_In_DateResource1" TextMode="DateTime" AutoPostBack="True"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="Check_In_Date_CalendarExtender" runat="server" TargetControlID="Check_In_Date" BehaviorID="Check_In_Date_CalendarExtender" />
</td>
<td style="height: 22px">
<asp:Label ID="Check_Out" runat="server" Text="Label" meta:resourcekey="Check_OutResource1"></asp:Label>
</td>
<td style="height: 22px">
<asp:TextBox ID="Check_Out_Date" runat="server" meta:resourcekey="Check_Out_DateResource1" TextMode="DateTime" AutoPostBack="True"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="Check_Out_Date_CalendarExtender" runat="server" TargetControlID="Check_Out_Date" BehaviorID="Check_Out_Date_CalendarExtender" />
</td>
</tr>
<tr style="margin-bottom: 5px">
<td></td>
<td>
<asp:RequiredFieldValidator ID="Destination_Validator" runat="server" ErrorMessage="<%$ Resources:Resource, Required_Field %>" ControlToValidate="Destination_Text" Font-Size="8pt" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td></td>
<td>
<asp:RequiredFieldValidator ID="Check_In_Validator" runat="server" ErrorMessage="<%$ Resources:Resource, Required_Field %>" ControlToValidate="Check_In_Date" Font-Size="8pt" ForeColor="Red" ></asp:RequiredFieldValidator>
</td>
<td></td>
<td>
<asp:RequiredFieldValidator ID="Check_Out_Validator" runat="server" ErrorMessage="<%$ Resources:Resource, Required_Field %>" ControlToValidate="Check_Out_Date" Font-Size="8pt" ForeColor="Red" ></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Adults" runat="server" Text="Label" meta:resourcekey="AdultsResource1"></asp:Label>
</td>
<td>
<asp:TextBox ID="Adult_Count" runat="server" type="number" TextMode="Number" meta:resourcekey="Adult_CountResource1" ForeColor="Black" MaxLength="2" Width="20px" Font-Size="10pt" ReadOnly="True" ViewStateMode="Enabled"></asp:TextBox>
<ajaxToolkit:NumericUpDownExtender ID="Adult_Count_NumericUpDownExtender" runat="server" TargetControlID="Adult_Count" Minimum="1" Width="50" BehaviorID="Adult_Count_NumericUpDownExtender" Maximum="10" RefValues="" ServiceDownMethod="" ServiceDownPath="" ServiceUpMethod="" Tag="" TargetButtonDownID="" TargetButtonUpID="" ViewStateMode="Enabled" />
</td>
<td>
<asp:Label ID="Children" runat="server" Text="Label" meta:resourcekey="ChildrenResource1"></asp:Label>
</td>
<td>
<asp:TextBox ID="Child_Count" runat="server" type="number" TextMode="Number" meta:resourcekey="Child_CountResource1" ForeColor="Black" MaxLength="2" Width="20px" Font-Size="10pt" ReadOnly="True" ViewStateMode="Enabled"></asp:TextBox>
<ajaxToolkit:NumericUpDownExtender ID="Child_Count_NumericUpDownExtender" runat="server" TargetControlID="Child_Count" Minimum="0" Width="50" BehaviorID="Child_Count_NumericUpDownExtender" Maximum="10" RefValues="" ServiceDownMethod="" ServiceDownPath="" ServiceUpMethod="" Tag="Child" TargetButtonDownID="" TargetButtonUpID="" ViewStateMode="Enabled" />
</td>
<td>
<asp:Label ID="Room_Size" runat="server" Text="Label" meta:resourcekey="Room_SizeResource1"></asp:Label>
</td>
<td>
<asp:DropDownList ID="Room_Size_List" runat="server" meta:resourcekey="Room_Size_ListResource1">
<asp:ListItem meta:resourcekey="ListItemResource1">1 adult</asp:ListItem>
<asp:ListItem meta:resourcekey="ListItemResource2">2 adults</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</tbody>
</table>
答案 0 :(得分:0)
我已经意识到问题所在。我粗心;我不知不觉地篡改了Site.css文件(主样式表)这样的样式
input,
select,
textarea {
max-width: 280px;
position: absolute;
top: 240px;
left: 193px;
z-index: 1;
right: 496px;
}
造成了这些问题。 通过删除top,left,z-index和right,控件重新就位。