show.dll的代码如下using System;
using System.Web.UI;
namespace firstcontent
{
    public class myshow:Control
    {
        protected override void Render(HtmlTextWriter writer)
        {
          writer.Write("<textarea id=\"dcontent\" name=\"dcontent\" runat=\"server\" style=\"display:none\"><div></div></textarea><iframe id=\"my\" src=\"/Edit/index.htm?id=dcontent\" frameborder=\"0\" scrolling=\"no\" width=\"800px\" height=\"460px\"></iframe>");
        }
    }
}
我的一个页面default.aspx引用了这个dll文件,具体代码如下Default.aspx代码<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="_Default"  Debug="true"%>
<%@Register TagPrefix="myfirstcontent" Namespace="firstcontent" Assembly="show"%>
<!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>
 <myfirstcontent:myshow runat="server" />
    </div>
    </form>
</body>
</html>Default.aspx.cs代码如下using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.dcontent.Value = "sdaflafasdfsdf"; //我这里是对show.dll中的 id="dcontent"的textarea赋值,但出现的问题是,总是提示错误“_Default”不包含“dcontent”的定义,并且找不到可接受类型为“_Default”的第一个参数的扩展方法“dcontent”(是否缺少 using 指令或程序集引用?)
        }        
    }请问,我如果想对dll中的textarea赋值,请问该怎么做呢?

解决方案 »

  1.   

    dcontent 你要把它设置成 runat = "server",并在.cs 里声明
      

  2.   

    什么意思?
    writer.Write(" <textarea id=\"dcontent\" name=\"dcontent\" runat=\"server\" style=\"display:none\"> <div> </div> </textarea> <iframe id=\"my\" src=\"/Edit/index.htm?id=dcontent\" frameborder=\"0\" scrolling=\"no\" width=\"800px\" height=\"460px\"> </iframe>"); 
    我的代码中写明了有runat="server"啊2楼兄弟,你说的在.cs里声明是怎么做呢?