Jquery asp:面板隐藏、显示和定位
我在一个分区内有以下两个面板:Jquery asp:面板隐藏、显示和定位,jquery,asp.net,css,Jquery,Asp.net,Css,我在一个分区内有以下两个面板: <div id="interval" style="margin-top:12px; float: left; margin-left: 10px;"> <div> <asp:Panel id="FrequencyMinutes" style="margin-left: 10px; margin-top: 2px" runat="server">
<div id="interval" style="margin-top:12px; float: left; margin-left: 10px;">
<div>
<asp:Panel id="FrequencyMinutes" style="margin-left: 10px; margin-top: 2px" runat="server">
<asp:DropDownList runat="server" DataSource="<%# Model.ScheduleIntervalList %>" SelectedValue="<%# Model.SelectedScheduleInterval %>" OnSelectedIndexChanged="ScheduleInterval_SelectedIndexChanged" ID="AVContentPollingFrequencyDropDownList">
</asp:DropDownList>
<asp:Localize ID="MinutesText" runat="server" Text="<%$ Resources:AntiVirus, AVRepl_Minutes %>"></asp:Localize>
<br />
</asp:Panel>
<asp:Panel id="TimePicker" style="margin-top: 2px; margin-left: 10px; min-width: 80%" runat="server">
<telerik:RadTimePicker Skin="Office2007" ID="StartTimeRadTimePicker" Width="15em" runat="server" OnSelectedDateChanged="StartTime_Changed" AutoPostBack="True" SelectedDate="<%# Model.ScheduleDateUpdated %>">
<DateInput ID="TimeInputTextBox" runat="server">
</DateInput>
<TimeView ID="TimeView" ShowHeader="false" Columns="6" Interval="0:30" runat="server" Visible="True">
</TimeView>
</telerik:RadTimePicker>
<asp:CustomValidator ID="RequiredTimeValidator" runat="server" Display="None"
OnServerValidate="ValidateScheduledDateTime" ErrorMessage="<%$ Resources:Console, StartTimeNotValid %>">
<asp:Image ID="Image1" runat="server" SkinID="ValidationErrorSkin" ToolTip="<%$ Resources:Console, StartTimeNotValid %>" />
</asp:CustomValidator>
</asp:Panel>
</div>
</div>
然后,我让JQuery根据radiobuttonlist中选择的listitem显示和隐藏这些面板:
$("#<%=pollingFrequencyRadioButtonList.ClientID%> input:radio").change(function() {
if (this.checked) {
if (this.value == "True") {
$("#" + "<%= FrequencyMinutes.ClientID %>").hide();
$("#" + "<%= TimePicker.ClientID %>").show();
}
else {
$("#" + "<%= FrequencyMinutes.ClientID %>").show();
$("#" + "<%= TimePicker.ClientID %>").hide();
}
}
}).filter(":checked").change();
$(“#输入:收音机”)。更改(函数(){
如果(选中此项){
如果(this.value==“True”){
$(#“+).hide();
$(#“+).show();
}
否则{
$(#“+).show();
$(#“+).hide();
}
}
}).filter(“:选中”).change();
问题是,当我隐藏第一个面板时,第二个面板会在它的位置跳起来。。
我想要的是第一个隐藏,第二个面板显示在它下面
关于如何实现这一点,您有什么想法吗?不要使用
.hide()
,它会将元素从流中移除(显示:无
),而是更改项目的可见性
使用
更改项目的可见性,而不是使用将元素从流中取出的
.hide()
(display:none
)
使用
谢谢你。。你能告诉我一种在代码背后做同样事情的方法吗?像这样的东西你正在寻找<代码>控件.属性[“样式”]=“可见性:隐藏”代码>或
BtnUpload.Style.Add(“可见性”、“隐藏”)代码>?我已经很长时间没有使用ASP了。您只需要将项目设置为具有可见性:隐藏代码>在CSS中。工作完美!谢谢谢谢你。。你能告诉我一种在代码背后做同样事情的方法吗?像这样的东西你正在寻找<代码>控件.属性[“样式”]=“可见性:隐藏”代码>或BtnUpload.Style.Add(“可见性”、“隐藏”)代码>?我已经很长时间没有使用ASP了。您只需要将项目设置为具有可见性:隐藏代码>在CSS中。工作完美!谢谢
.css('visibility', 'hidden'); //for hide
.css('visibility', 'visible'); //for show