VS2005中頁面間的調用
我建兩個webformpage1.aspxusing System;
using System.Data;
using Pagenamespace2;namespace Pagenamespace1;
{
public partial class page1: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ page2 pag=new page2();//這里寫的時候都沒有彈出有page2的類也不能這樣寫
請問在VS2005中如何用頁面間的繼承問題。我想這樣能用page2的class怎么辦??
不要說把page2.aspx.cs放在App_code中﹐我知道這樣可以﹐
但在前面寫的CodeFile="..\App_code\page2.aspx.cs"就不能訪問這個文件了。
}
}
}page2.aspxusing System;
using System.Data;
using Pagenamespace1;namespace Pagenamespace2;
{
public partial class page2: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//
}
}
}
我建兩個webformpage1.aspxusing System;
using System.Data;
using Pagenamespace2;namespace Pagenamespace1;
{
public partial class page1: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ page2 pag=new page2();//這里寫的時候都沒有彈出有page2的類也不能這樣寫
請問在VS2005中如何用頁面間的繼承問題。我想這樣能用page2的class怎么辦??
不要說把page2.aspx.cs放在App_code中﹐我知道這樣可以﹐
但在前面寫的CodeFile="..\App_code\page2.aspx.cs"就不能訪問這個文件了。
}
}
}page2.aspxusing System;
using System.Data;
using Pagenamespace1;namespace Pagenamespace2;
{
public partial class page2: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//
}
}
}
解决方案 »
- 创建了一个递归的产品分类表,怎么查询自己要的数据.
- 两层名字空间的dll文件是怎么样弄成的???
- 一段asp代码改成C#版 谢谢了
- 求助
- ASP.net的问题,_Default的编译错误,这是怎么回事?
- 框架的问题,老是解决不掉
- 我的程序TreeView在客户段无法正确显示!
- 谁有共享版《我爱背单词》的注册码或注册机,请发过来可以吗?大家一般在哪里找注册码或注册机?
- 我从beta1 用到现在, 不知道什么时候会有人要这方面 的人:)
- zilong28:请教各位大侠这是什么错误Server Error in '/' Application.
- |M| 还是HTML排放的问题,Table 上 中 下 问题 谢谢
- 请教:按日期列出数据
using System.Data;
using Pagenamespace2;namespace Pagenamespace1;
{
public partial class page1: page2
{
protected void Page_Load(object sender, EventArgs e)
{ TextBoxt1.Text="kdksk";//這是在page2中的一個textboxt.
這句有一個如下提示是什么會事???
}
}
}page2.aspxusing System;
using System.Data;
using Pagenamespace1;namespace Pagenamespace2;
{
public partial class page2: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//
}
}
}'System.NullReferenceException' 類型的例外狀況發生於 App_Web_f_yxi5yq.dll,但使用者程式碼未加以處理其他資訊: 並未將物件參考設定為物件的執行個體
要怎么樣去寫??問題是怎么樣才可以調用另一頁面中的控件,頁面之間的繼承可不可以控件繼承!??
比如主界面
default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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 runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<iframe id="up" frameborder="0" src="Default1.aspx"></iframe>
<iframe id="down" frameborder="0" src="Default2.aspx"></iframe>
</div>
</form>
</body>
</html>上框架内页面 Default1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default1.aspx.cs" Inherits="Default1" %><!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 runat="server">
<title>无标题页</title>
<script type="text/javascript">
function ChangeTxt()
{
var txt = self.parent.frames["down"].window.document.all["TextBox1"];
txt.value = document.all["TextBox1"].value;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server">test</asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="ChangeTxt();" /> <br />
</div>
</form>
</body>
</html>下框架内页面 Default2.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %><!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 runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>