蜗牛,在赛跑

--努力去改变吧
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

获取用户控件值的方法

Posted on 2007-08-10 14:30  body  阅读(291)  评论(0)    收藏  举报
  WebUserControl1.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="TestTree.WebUserControl1" %>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


WebForm1.aspx
  protected void Button1_Click(object sender, EventArgs e)
        {
            TextBox txtName = (TextBox)WebUserControl1_1.FindControl("TextBox1");
            Response.Write(txtName.Text.ToString());
        }