NET cannot find a solution to a namespace

Source: Internet
Author: User

NET cannot find a solution to a namespace

<%@ Page language= "C #" src= "Parent.aspx.cs" autoeventwireup= "false" inherits= "Test.parent"%>
<%@ Register tagprefix= "subpage" tagname= "mysub" src= "Subpage.ascx"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<title>parent</title>
<meta name= "generator" content= "Microsoft Visual Studio. NET 7.1" >
<meta name= "Code_language" content= "C #" >
<meta name= "vs_defaultClientScript" content= "JavaScript" >
<meta name= "vs_targetschema" content= "http://schemas.microsoft.com/intellisense/ie5" >
</HEAD>
<body>
<form id= "Form1" method= "POST" runat= "Server" >
<P>
<subpage:mysub id= "Top" runat= "Server" ></subpage:mysub></P>
<P>
<asp:textbox id= "Parenttext" runat= "Server" > Parent page text box </asp:TextBox>
<asp:button id= "Parentbutton" runat= "Server" text= "parent page button" ></asp:Button></P>
</form>
</body>
</HTML>

//File Parent.aspx.cs code as follows:
Using System;
Using System.Collections;
Using System.ComponentModel;
Using System.Data;
Using System.Drawing;
Using System.Web;
Using System.Web.SessionState;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.HtmlControls;
Namespace test
{
<summary>
Parent's summary description.
</summary>
public class Parent:System.Web.UI.Page
{
Public System.Web.UI.WebControls.TextBox Parenttext;
protected System.Web.UI.WebControls.Button Parentbutton;
private void Page_Load (object sender, System.EventArgs e)
{
Place user code here to initialize page
}
Code generated #region the Web forms Designer
Override protected void OnInit (EventArgs e)
{
//
CodeGen: This call is required for the ASP.net Web forms Designer.
//
InitializeComponent ();
Base. OnInit (e);
}
<summary>
Designer supports required methods-do not use the Code editor to modify
The contents of this method.
</summary>
private void InitializeComponent ()
{
This.parentButton.Click + = new System.EventHandler (This.parentbutton_click);
This. Load + = new System.EventHandler (this. Page_Load);
}
#endregion
private void Parentbutton_click (object sender, System.EventArgs e)
{
This.parentText.Text = "Parent page click Changed";
((subpage) this. FindControl ("Top")). Subtext.text = "Parent page click Changed";
}
}
}

//File Subpage.ascx code as follows:
<%@ control language= "C #" autoeventwireup= "false" src= "Subpage.ascx.cs"inherits= "Test.subpage"Targetschema= "Http://schemas.microsoft.com/intellisense/ie5"%>
<font face= "Song Body" >
<asp:textbox id= "Subtext" runat= "Server" > Custom control text Box </asp:TextBox>
<asp:button id= "Button1" runat= "Server" text= "Custom control button" ></asp:Button></FONT>

//File Subpage.ascx.cs code as follows

Namespace test
{
Using System;
Using System.Data;
Using System.Drawing;
Using System.Web;
Using System.Web.UI.WebControls;
Using System.Web.UI.HtmlControls;
<summary>
Summary description of the subpage.
</summary>
Public class Subpage:System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.Button Button1;
public System.Web.UI.WebControls.TextBox subtext;
private void Page_Load (object sender, System.EventArgs e)
{
if (!this. IsPostBack)
{}
}
Code generated #region the Web forms Designer
Override protected void OnInit (EventArgs e)
{
//
CodeGen: This call is required for the ASP.net Web forms Designer.
//
InitializeComponent ();
Base. OnInit (e);
}
<summary>
Designer supports the desired method-do not use the Code Editor
Modify the contents of this method.
</summary>
private void InitializeComponent ()
{
This. Button1.Click + = new System.EventHandler (this. Button1_Click);
This. Load + = new System.EventHandler (this. Page_Load);
}
#endregion
private void Button1_Click (object sender, System.EventArgs e)
{
This.subText.Text = "This is clicked by the child control button." ";
((TextBox) this. Parent.findcontrol ("Parenttext")). Text = "This is clicked by the child control button. ";
}
}
}

Using System;
Using System.Collections;
Using System.ComponentModel;
Using System.Data;
Using System.Drawing;
Using System.Web;
Using System.Web.SessionState;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.HtmlControls;
How can you not see the space that quotes you

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.