【求助】如何在ASP.NET MVC 中“使用”服务器控件?
我要使用一个代码高亮类库(Actipro CodeHighlighter)。
这个是用服务器控件做成的。
那么问题是……
如何在ASP.NET MVC 中使用?
我在 Controller 里使用如下:
C# code:
CodeHighlighter codeHighlighter = new CodeHighlighter();
codeHighlighter.PostRender += new EventHandler(codeHighlighter_PostRender);
codeHighlighter.LanguageKey = "C#";
codeHighlighter.OutliningEnabled = true;
codeHighlighter.LineNumberMarginVisible = false;
codeHighlighter.Text = System.IO.File.ReadAllText(path, System.Text.Encoding.Default).Replace("\\", "\\\\");
this["Title"] = id + "Controller";
this["Content"] = codeHighlighter.Output;
其中 CodeHighlighter ,是这个服务器控件。
我用 CodeHighlighter.RenderControl(tw) 提示的是……请求在当前上下文无法使用。
我想知道如何使用?
怎么办怎么办?
codeHighlighter.RenderControl(HttpContext.Response.Output as HtmlTextWriter);
未将对象引用设置到对象的实例。
求助啊。怎么没人进来瞧瞧啊
解决了~哎。现在的世道……
相关问答:
function CheckOpwd(){//验证用户名
var pwd=document.all.txtOpwd;
var div1=document.getElementById("divPwd");
if (pwd.value=="")
{
......
<table style="width: 1000px"><tr>
<td style="height: 38px; width: 35px;">
姓名</td>
......
我创建了一个物品浏览页面:bookview.aspx,其中在页面的左侧列出物品的分类:分类1,连接到页面bookview.aspx?id=1,其他依次类推,当页面第一次加载的时候设置id的默认值为1,运行程序发现页面一直出于重新加 ......
C# code:
SqlConnection conn = CsDB.sqlcon();
SqlDataAdapter da = new SqlDataAdapter("select fwCoding from bjmuma_fwCoding where OrderNumber='" + Order + & ......
3个radioButton
一个Button
一个label
C# code:
protected void Button1_Click(object sender, EventArgs e)
{
string str = null;
RadioButton rdo=(RadioButton)sender;
......