<script type="text/javascript" language="javascript">
function pageLoad(sender, args) {
$('#bvft').addClass("bvft");
$('#new').live('click', function() {
$('#bvft').removeClass("bvft");
$('#bvft').show("slow");
});
$('.ddlFrTime').change(function() {
var vFTime = $('.ddlFrTime').val();
if (vFTime != "") {
$('#bvft').removeClass("bvft");
$('#bvft').show("slow");
}
else { alert("sorry"); }
});
}
</script>
In $('#bvft'), I have one dropdownlist
<asp:DropDownList ID="ddlFrTime" runat="server" Width="250px" CssClass="ddlFrTime" AutoPostBack="true"
OnSelectedIndexChanged="ddlFrTime_SelectedIndexChanged">
</asp:DropDownList>
$(#bvft) is div id. $('#new') is button id. When page load, I want to disable. It works perfect. When I click the button, $(#bvft) div will show. But the problem is (in div, I have dropdownlist) when I select dropdownlist, the postback will work. At this time div is automatically hide back. How to prevent for this. Actually I used function pageLoad() to prevent postback. But it's not working.
将下拉框的autopostback设置为false
Now I got an answer... I put some code after function pageLoad()... like this
function pageLoad(sender, args) {
if (!args.get_isPartialLoad()) {
$('#bvft').slideUp('slow');
}
else {
$('#bvft').slideDown('slow');
}
}
It will work pretty... no problem for postback...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.