如何更改div的内部html
我有一个 div
和一个 html 编辑器,并尝试:
- 将 div 内部 html 添加到 编辑。 (完成)
- 然后在编辑器中完成任何更改 被保存回div中。
这是后台代码:
protected void Page_Load(object sender, EventArgs e)
{
Editor.Content = cvDiv.InnerHtml;
}
protected void preview(object sender, EventArgs e) //this is an onclick event
{
cvDiv.InnerHtml = Editor.Content;
}
和编辑器的代码:
<asp:ScriptManager runat="server" />
<cc1:Editor ID="Editor" runat="server" OnContentChanged="preview" />
<asp:Button runat="server" ID="eButton" CssClass="eButton" Text="Edit" OnClick="Edit" />// this is the button that is supposed to save
但它不起作用。
所以我想做的是将编辑器中所做的任何更改保存到 div
使用 asp.net 3.5 和 ajax 工具包编辑器。
提前致谢。
i have a div
and an html editor and trying to:
- add the div inner html to the
editor. (thats done) - then any changes done in the editor
is saved back in the div.
here is the backcode :
protected void Page_Load(object sender, EventArgs e)
{
Editor.Content = cvDiv.InnerHtml;
}
protected void preview(object sender, EventArgs e) //this is an onclick event
{
cvDiv.InnerHtml = Editor.Content;
}
and the code for the editor:
<asp:ScriptManager runat="server" />
<cc1:Editor ID="Editor" runat="server" OnContentChanged="preview" />
<asp:Button runat="server" ID="eButton" CssClass="eButton" Text="Edit" OnClick="Edit" />// this is the button that is supposed to save
but it doesnt work.
so what i am trying to do is save whatever changes made in the editor to the div
using asp.net 3.5, and the ajax toolkit editor.
thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我为向您展示有效代码而制作的示例。
ASPX
ASPX.CS
This is an example i've made to show you a working code.
ASPX
ASPX.CS
您可以尝试使用
Literal
控件而不是服务器端吗?
Can you try using
Literal
control rather than a server side<div />
?