错误asp.net C# [英] Error in asp.net C#
本文介绍了错误asp.net C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过Editor1的参数:
How to pass Editor1 as Parameter:
在我的aspx.cs我给一个函数这是在为同一个项目cs文件的调用,如下所示:
In my aspx.cs i am giving a call to a function which is in .cs file for the same project, as follows:
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
DropDown abs = new DropDown();
abs.dd(this.DropDownList2, this.DropDownList3);
}
.CS文件code
public void dd(DropDownList DropDownList2, DropDownList DropDownList3)
{
//My code which contains DropDownList2 DropDownList3 and Editor1
}
这是我收到的错误是:
Error 1 The name 'Editor1' does not exist in the current context
我已经通过了DropDownList2和DropDownList3的方式我不能够通过Editor1(这是一个Ajax控件)。如何传递呢?
The way i have passed DropDownList2 and DropDownList3 i am not able to pass Editor1(It is an ajax control). How do i pass it?
推荐答案
如果出于某种原因,你的控制不是由设计师赋予后备的财产,你可以在你这样的事件处理程序得到它的引用:
If for whatever reason your control isn't being assigned a backing property by the designer, you can get a reference to it in your event handler thus:
var editor1 = (AjaxControlToolkit.HTMLEditor.Editor)FindControl("Editor1");
和传递这是一个额外的参数给DD方法:
and pass this as an extra parameter to the dd method:
public void dd(
DropDownList DropDownList2,
DropDownList DropDownList3,
AjaxControlToolkit.HTMLEditor.Editor Editor1)
这篇关于错误asp.net C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文