我有一個母版頁,有兩個ContentPlaceHolders
。使用窗體runat =具有母版頁的服務器的問題?
我有一個使用此母版頁的默認page.aspx。
在默認頁面ContentHolder
有一個TreeView
而另一個有GridView
。
現在我需要將它們都顯示在一起,都需要<form runat="server">
。
但問題是,我不能在一個頁面中有兩個<form runat="server">
的實例。
我試圖把<form runat="server">
母版頁上,但隨後TreeView
和GridView
功能停止工作.....
請幫我一下,我能做些什麼來解決這個問題。
頁文件:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="GridViewPg1.aspx.cs" Inherits="GridViewPg1" %>
<%@ Register assembly="obout_Grid_NET" namespace="Obout.Grid" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<form id="form1" runat="server">
<asp:Panel ID="Panel1" runat="server" ScrollBars="Vertical">
<a style="color: #000000; font-weight: bold;">SumooHServer</a>
<p> <asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:SumooHAgentDBConnectionString %>"
SelectCommand="SELECT DISTINCT [MachineGroupName], [MachineGroupID] FROM [MachineGroups]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:SumooHAgentDBConnectionString %>"
SelectCommand="SELECT DISTINCT [PolicyID], [PolicyName] FROM [Policies]">
</asp:SqlDataSource>
<asp:TreeView ID="TreeView2" runat="server"
ontreenodepopulate="TreeView2_TreeNodePopulate">
<Nodes>
<asp:TreeNode NavigateUrl="~/GridViewPg1.aspx" PopulateOnDemand="True"
Text="Machine Group" Value="Machine Group"></asp:TreeNode>
</Nodes>
</asp:TreeView>
<asp:TreeView ID="TreeView3" runat="server"
ontreenodepopulate="TreeView3_TreeNodePopulate">
<Nodes>
<asp:TreeNode PopulateOnDemand="True" Text="Policies" Value="Policies">
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</p></asp:Panel>
</form>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<asp:Panel ID="Panel2" runat="server" ScrollBars="None" Width="100%">
<cc1:Grid ID="Grid1" runat="server" AllowFiltering="True"
AllowGrouping="True" DataSourceID="SqlDataSource3">
</cc1:Grid>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:SumooHAgentDBConnectionString %>"
SelectCommand="SELECT * FROM [MachineGroups]"></asp:SqlDataSource>
</asp:Panel>
</asp:Content>
母版文件:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SumooH</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="wrapper">
<div id="header"
style="border-bottom-style: solid; border-bottom-color: #0000FF; border-bottom-width: medium">
</div>
<div id="left-content"
style="border-right: thin ridge #000000; top: 104px;">
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="content-wrapper">
<div id="content-inner">
<asp:ContentPlaceHolder id="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="footer">
<p> </p>
</div>
</div>
</div>
</body>
</html>
請說明你的問題;這是無法理解的 – jagprinderdeep 2009-09-22 20:20:28
問題是我無法得到treeview和gridview不能在一起顯示 – user175084 2009-09-22 20:21:58
代碼是有幫助的... – TJMonk15 2009-09-22 20:24:14