Using gridview within a masterpage
I am creating a new page in VS2005 (VB) and it has a gridview, my problem is when I try to insert the grid into the ContentPlaceHolder (in design mode) it ends up somewhere else on the page all together. I am using a masterpage, but not sure what I am doing wrong.
ASPX code
<%@ 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="Tru开发者_C百科e" 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>
I do not exactly understand what you mean by "it ends up somewhere else on the page all together" But if yourproblem is about with the location of the grid change its z-index and position properties
精彩评论