All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
aspx页面中Request读取字符成乱码或不准_[Asp.Net教程]
学习PHP小结:PHP编程中常用的三则技巧_php资料_编程技术
C#网络应用编程基础练习题与答案(十)_[Asp.Net教程]
PHP分析.wav文件并绘制png格式的波形图_php资料_编程技术
多种方法实现超长字符用-.....-代替_[Asp.Net教程]
掌握SQL Server的锁机制和锁模式_[SQL Server教程]
如何清除SQL日志_[SQL Server教程]
ASP.NET获取服务器IP与MAC地址的方法_.net资料_编程技术
PHP和JS实现普通HTTP上安全地传输密码_php资料_编程技术
URL重写可删节日期模式--
Reading number is top 10 pictures
俄罗斯台球天后惊艳魅惑1
Japanese snow monkeys in the hot spring to keep warm, close their eyes to enjoy
Beautiful vacuum girl1
A man's favorite things7
玩手机对身体不好
Sora aoi possession photo2
The money of more than 100 countries and regions13
The Soviet union swimsuit exposure in the 70 year1
Beauty ZhiHuiLin2
girl of HuNan name is LiXiang(湖南辣姐李湘的写真)
Download software ranking
WebService在.NET中的实战应用教学视频 → 第2集
Unix video tutorial11
Photoshop 8.0图象编辑软件
美女写真1
matrix3
美女写真2
功夫熊猫2(上集)
WebService在.NET中的实战应用教学视频 → 第1集
星际争霸1.08硬盘免安装版
Jinling thirteen stock
aaa published in(发表于) 2013/12/6 10:24:20 Edit(编辑)
asp.net,2.0中不同web控件之间的相互调用_.net资料_编程技术

asp.net,2.0中不同web控件之间的相互调用_.net资料_编程技术

asp.net 2.0中不同web控件之间的相互调用_.net资料_编程技术-数科优化网

在asp.net 2.0中,要在不同的web控件之间互相调用,必须要<%@ Reference VirtualPath="另一控件名称“>来引用,举例如下



default.aspx:





我们要实现的是,按下控件1的按钮后,将在控件2的文本框中显示出指定的文本


在首页里,分别调用了控件1和控件2


webcontrol.ascx:


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>


<%@ Reference VirtualPath="~/WebUserControl2.ascx" %>



这里放置一个按钮,然后用reference来引用控件2


webcontrol.ascx.cs:


protected void Button1_Click(object sender, EventArgs e)
{


WebUserControl2 w = Page.FindControl("WebUserControl2_1") as WebUserControl2;
w.Text = "Hello all!";


}


对于控件2:


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl2.ascx.cs" Inherits="WebUserControl2" %>



控件2的codebehind代码:
public partial class WebUserControl2 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{


}
public string Text
{


set { TextBox1.Text = value; }


}


}






添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.