一个关于dll的问题

xiaomangxian 2009-01-10 05:21:42
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赋值,请问该怎么做呢?

...全文
110 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaomangxian 2009-01-12
  • 打赏
  • 举报
回复
重新顶起来,请大家帮忙解决下,谢谢
xiaomangxian 2009-01-10
  • 打赏
  • 举报
回复
什么意思?
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里声明是怎么做呢?
che2piaopiao 2009-01-10
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 huwei2003 的回复:]
dcontent 你要把它设置成 runat = "server",并在.cs 里声明
[/Quote]

mark
Jack2013tong 2009-01-10
  • 打赏
  • 举报
回复
dcontent 你要把它设置成 runat = "server",并在.cs 里声明

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧