如何访问母版页代码后面的 Telerik RadEditor 控件(嵌入在内容页面中)?

发布于 2024-09-30 10:10:12 字数 364 浏览 2 评论 0原文

if (ContentPlaceHolders.Contains(Telerik.RadEditor)) { label1.Text = ("lkjjljlj!"); 上面的显然

不起作用

[编辑]尝试了以下..

if(ContentPlaceHolder1.Controls.Equals(Telerik.Web.UI.RadEditor))
{
            label1.Text = ("lkjjljlj!");
        }

它给出了错误“'Telerik.Web.UI.RadEditor'是一个'类型',在给定的上下文中无效”

if (ContentPlaceHolders.Contains(Telerik.RadEditor))
{
label1.Text = ("lkjjljlj!");
}

the above apparently didnt work

[edit] tried the following..

if(ContentPlaceHolder1.Controls.Equals(Telerik.Web.UI.RadEditor))
{
            label1.Text = ("lkjjljlj!");
        }

its giving the error "'Telerik.Web.UI.RadEditor' is a 'type', which is not valid in the given context"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温暖的光 2024-10-07 10:10:12

这里有一些方法可以做你想做的事:

//loop
foreach(MyContentPlaceHolder.Controls 中的 Control 控件)
{
if(typeof(control).Equals(Telerik.Web.UI.RadEditor)
{
//设置标签的文本
}
}

//如果适用的话,直接通过 id 引用编辑器
MyContentPlaceHolder.FindControl("RadEditorIDHere")

Here are a couple of methods to do what you want:

//loop
foreach (Control control in MyContentPlaceHolder.Controls)
{
if(typeof(control).Equals(Telerik.Web.UI.RadEditor)
{
//set the text of the label
}
}

//reference the editor directly by its id, if applicable
MyContentPlaceHolder.FindControl("RadEditorIDHere")

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文