我刚刚开始学习jQuery,并希望将内容从一个单独的.aspx页面动态加载到div中http://www.asp.net/ajaxLibrary/jquery_webforms_dynamic_load.ashx?HL=var“rel=”nofollow“>http://www.asp.net/ajaxLibrary/jquery_webforms_dynamic_load.ashx?HL=var。
然而,它似乎没有回应,我可能错过了其中的一部分。以下是我的.aspx页面中的代码/脚本:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script src="Scripts/jquery-1.5.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
// External ASPX Page calling
$("#btn_Submit").click(loadDynamic);
});
function loadDynamic() {
$("#dynamicResults").load("ResultsView.aspx",
{name: $("#cbox_User").val() },
function (content) {
$(this).hide().fadeIn("slow");
return false;
});
}
<Header>
QUERY VIEW
</Header>
<Content>
<div style="float:right; height:154px; width: 947px; margin-left: 0px; background-color: #E0E0E0;">
<br />
<asp:Label ID="Label2" runat="server" Text="Select a User:"
Style="margin-left:28px" ></asp:Label>
<asp:ComboBox ID="cbox_User" runat="server" AutoCompleteMode="SuggestAppend">
</asp:ComboBox>
<asp:Label ID="Label3" runat="server" Text="Select a Month:"
Style="margin-left:28px" ></asp:Label>
<asp:TextBox ID="txt_Date" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" runat="server"
TargetControlID="txt_Date"
Format="MMMM yyyy"
OnClientShown="onCalendarShown"
OnClientHidden="onCalendarHidden"
BehaviorID="calendar1" >
</asp:CalendarExtender>
<asp:Button ID="btn_Submit" runat="server" Text="Submit" Style="margin-left:28px" onclick="Btn_Submit_Click" />
</div>
</Content>
<Header>
RESULTS VIEW
</Header>
<Content>
<div id="dynamicResults">
</div>
<div style="border-style: none; height:340px; width: 770px; position:relative; top: 10px; left: -2px;">
<asp:GridView ID="ResultsView" runat="server" CellPadding="3"
ForeColor="Black" GridLines="None" AllowPaging="False"
Visible="False"
Height="318px" style="margin-left: 32px; margin-top: 2px;" Width="718px"
BackColor="White" BorderColor="#999999" BorderStyle="Solid"
BorderWidth="1px">
</asp:GridView>
</div>
</Content>
在第二个.aspx页面中,我只想动态加载一个div:
<html xmlns="http://www.w3.org/1999/xhtml">
<div style="background-color:#E0E0E0; border-style: ridge none none none; border- width: thin; border-color: #B3B3B3; height:120px; width: 770px; position:relative; top: 10px; left: 8px;">
<asp:Label ID="lbl_Header" runat="server" Text="User Information:"></asp:Label>
</div>
</html>