我有一个带有gridview的页面,该页面显示查询结果并具有分页和搜索栏。当我自己加载它而不是母版页时它工作正常但是当我向它添加母版页时,所有控件都消失了。下面是包含母版页而没有
的代码<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="Default3.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent"
Runat="Server">
<%@ Import Namespace="GridView" %>
<div>
<div align="center" class="padded" >
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
Font-Size="Large" OnSelectedIndexChanged="Refresh_Click">
</asp:DropDownList>
<asp:Button ID="Refresh" runat="server" OnClick="Refresh_Click"
Text="Search" Visible="False" />
</div>
<div>
<cc1:HTMLGridView ID="HTMLGridView1" runat="server"
OnRowDataBound="OnRowDataBound2"/>
</div>
以下是不使用母版页的代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs"
Inherits="_Default" %>
<%@ Register assembly="GridView" namespace="GridView" tagprefix="cc1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div align="center" class="padded" >
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
Font-Size="Large" OnSelectedIndexChanged="Refresh_Click">
</asp:DropDownList>
<asp:Button ID="Refresh" runat="server" OnClick="Refresh_Click"
Text="Search" Visible="False" />
</div>
<cc1:HTMLGridView ID="HTMLGridView1" runat="server"
OnRowDataBound="OnRowDataBound2" allowDeleting="False" allowEditing="False"
allowView="False"/>
</form>
</body>
</html>
我还添加了对web.config文件的引用,但我没有运气
<add tagPrefix="cc1" namespace="GridView" assembly="GridView" />
我哪里错了?
答案 0 :(得分:0)
尝试添加
<%@ Import Namespace="GridView" %>
之前
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent"
Runat="Server">