无法从UpdatePanel的DetailsView中获取fckeditor 的值

yjf_1982 2009-02-20 09:13:53
<asp:UpdatePanel ID="UpdatePanelDetailsView" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DetailsView ID="dvCustomerDetail" runat="server" AutoGenerateRows="False" BorderWidth="0px"
CellPadding="4" CellSpacing="1" CssClass="forumline" Width="830px"
DataKeyNames="id" OnItemUpdating="dvCustomerDetail_ItemUpdating" OnItemInserting="dvCustomerDetail_ItemInserting" OnModeChanging="dvCustomerDetail_ModeChanging" OnDataBound="dvCustomerDetail_DataBound">
<Fields>
<asp:TemplateField HeaderText="标题:">
<EditItemTemplate>
<asp:TextBox ID="txtTitle" runat="server" Text=' <%# Bind("Title") %>' />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="txtTitle" runat="server" />
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="内容:">
<EditItemTemplate>
<FCKeditorV2:FCKeditor ID="txtDetail" runat="server" Height="400px" Value=' <%# Bind("Detail") %>'> </FCKeditorV2:FCKeditor>
</EditItemTemplate>
<InsertItemTemplate>
<FCKeditorV2:FCKeditor ID="txtDetail" runat="server" Height="400px"> </FCKeditorV2:FCKeditor>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<center>
<asp:LinkButton ID="btnSave" runat="server" CausesValidation="True" CommandName="Update"
Text="修改"> </asp:LinkButton>
<asp:LinkButton ID="btnCancel" runat="server" CausesValidation="False" CommandName="Cancel"
Text="取消" > </asp:LinkButton>
</center>
</EditItemTemplate>
<InsertItemTemplate>
<center>
<asp:LinkButton ID="btnSave" runat="server" CausesValidation="True" CommandName="Insert"
Text="添加"> </asp:LinkButton>
<asp:LinkButton ID="btnInsCancel" runat="server" CausesValidation="False" CommandName="Cancel"
Text="取消" > </asp:LinkButton>
</center>
</InsertItemTemplate>
</asp:TemplateField>
</Fields>

</asp:DetailsView>
</ContentTemplate>
</asp:UpdatePanel>


在后台无法获取fckeditor 的值 ,网上说加入

Page.ClientScript.RegisterOnSubmitStatement(txtDetail.GetType(), "editor", "FCKeditorAPI.GetInstance('" + txtDetail.ClientID + "').UpdateLinkedField();");

就可以获取值;可是我加了没有效果,可能是加的位置不对,如果加才能获取值呢?
...全文
185 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
truecoffeefox 2010-07-29
  • 打赏
  • 举报
回复
一层一层的findcontrol就可以了,干嘛不用js,纳闷
lianbang 2010-07-29
  • 打赏
  • 举报
回复
网上一位仁兄写的http://blog.sina.com.cn/s/blog_41786bfd0100fifr.html
Marlboro_hui 2009-04-28
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 Marlboro_hui 的回复:]
using FredCK.FCKeditorV2;

string str = (this.DetailsViewProduct.FindControl("FCKeditorEdit") as FCKeditor).Value;

这样可以取出来 试过了
[/Quote]

要添加引用 using FredCK.FCKeditorV2;
然后 (DetailesView.FindControl("你的FCKEditor的ID") as FCKeditor)这样就可以得到一个FCKEditor
想要它的什么内容都可以了!
Marlboro_hui 2009-04-28
  • 打赏
  • 举报
回复
using FredCK.FCKeditorV2;

string str = (this.DetailsViewProduct.FindControl("FCKeditorEdit") as FCKeditor).Value;

这样可以取出来 试过了
萤火架构 2009-02-25
  • 打赏
  • 举报
回复
你怎么获取的数据?应该到模板里边查找
浮生若梦丶 2009-02-20
  • 打赏
  • 举报
回复
.
yjf_1982 2009-02-20
  • 打赏
  • 举报
回复
不行
君黑鲩 2009-02-20
  • 打赏
  • 举报
回复
<InsertItemTemplate>
<FCKeditorV2:FCKeditor ID="txtDetail" runat="server" Height="400px"> </FCKeditorV2:FCKeditor>
</InsertItemTemplate>

没有绑定数据
跟第一个FCKeditor控件一样加上Value='<%# Bind("Detail") %>'试试
君黑鲩 2009-02-20
  • 打赏
  • 举报
回复
是不是你两个控件的ID一样引起的问题? <FCKeditorV2:FCKeditor ID="txtDetail" runat="server" Height="400px" Value=' <%# Bind("Detail") %>'> </FCKeditorV2:FCKeditor>
</EditItemTemplate>
<InsertItemTemplate>
<FCKeditorV2:FCKeditor ID="txtDetail"
萤火架构 2009-02-20
  • 打赏
  • 举报
回复
没搞这么复杂,帮你顶顶
Page.ClientScript.RegisterOnSubmitStatement(txtDetail.GetType(), "editor", "FCKeditorAPI.GetInstance('" + txtDetail.ClientID + "').UpdateLinkedField();");

txtDetail是一个嵌套进去的控件,txtDetail.ClientID这样能找到吗?

yjf_1982 2009-02-20
  • 打赏
  • 举报
回复
有没有遇到过这样问题的朋友
yjf_1982 2009-02-20
  • 打赏
  • 举报
回复
不行,有没有用过的朋友

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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