4
我正在使用乾淨的測試頁面,並使用jQuery的函數加載user control
。 當前的錯誤,我得到的是這樣的:
GET http://localhost:27950/OCDB/test.ascx 403 (Forbidden)
使用jQuery加載用戶控件。()
這裏是我的網頁代碼:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<%@ Register Src="~/test.ascx" TagPrefix="uc1" TagName="test" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>This is a test.</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#ucPlaceholder').load('test.ascx');
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="ucPlaceholder">
</div>
</form>
</body>
</html>
我的用戶控件代碼:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="test.ascx.cs" Inherits="test" %>
<input placeholder="test input"/>
正如你可以看到,它的超級簡單。我的直接猜測是該網頁沒有收錄Register
。任何人都可以告訴我我要去哪裏嗎?
我有加載''...它的表現'無法解析symbol'問題的問題。 –
TheGeekZn
2013-03-19 10:50:03
@NewAmbition在web配置文件中? – 2013-03-19 10:52:37
是的。但是我意識到'IHttpHandler'需要放在'.cs'文件中。現在它可以正確地使用' '使用http://www.codeproject.com/Articles/117475/Load-ASP-Net-User - 控制 - 動態使用,jQuery的。 –
TheGeekZn
2013-03-19 10:55:33