我在VS2005(VB)中創建一個新頁面,它有一個gridview,我的問題是當我嘗試將網格插入到ContentPlaceHolder(在設計模式中)時,它最終在其他地方在一起的頁面。我正在使用一個母版頁,但不知道我做錯了什麼。在主頁面中使用gridview
ASPX代碼
<%@ Page Language="vb" MasterPageFile="~/secure/Master1.Master" CodeBehind="Master1.Master.vb" Inherits="Main.LiveCalendar" %>
<asp:Content ID="ContentPlaceHolder" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>Live Calendar</h1>
<%--<asp:Label runat="server" id="lblMessage" Text=""></asp:Label>--%>
<asp:gridview id="GridView1" runat="server" allowsorting="True" autogeneratecolumns="False"
datasourceid="SqlDataSource1" style="z-index: 100; left: 0px; position: absolute;
top: 0px" Height="101px" Width="224px"><Columns>
<asp:BoundField DataField="P_AE_ID" SortExpression="P_AE_ID" HeaderText="P_AE_ID"></asp:BoundField>
<asp:BoundField DataField="P_Name" SortExpression="P_Name" HeaderText="P_Name"></asp:BoundField>
<asp:BoundField DataField="P_Start" SortExpression="P_Start" HeaderText="P_Win_Start"></asp:BoundField>
<asp:BoundField DataField="P_End" SortExpression="P_End" HeaderText="P_Win_End"></asp:BoundField>
<asp:BoundField DataField="P_Status" SortExpression="P_Status" HeaderText="P_Status"></asp:BoundField>
<asp:BoundField ReadOnly="True" DataField="CountOfPED_ID" SortExpression="CountOfPED_ID" HeaderText="CountOfPED_ID"></asp:BoundField>
</Columns>
</asp:gridview>
<p>
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:dbConnection %>"
selectcommand="web_Public" selectcommandtype="StoredProcedure"></asp:sqldatasource>
</p>
</asp:Content>
上面的代碼看起來不錯,你確定你指向了masterpage上的正確的contentplaceholder嗎?如果您還可以請添加您的主頁面代碼 – 2011-04-14 13:03:32