如何在回发时将 JavaScript 值推送到服务器?

发布于 2024-08-09 16:35:25 字数 672 浏览 1 评论 0原文

我只是在玩 ckeditor,但无法让这个该死的东西为我工作。我以某种方式需要在回发之前或同时“数据绑定”文本框。我该怎么做?

加载数据很好,但是当我单击更新时,我需要以某种方式检索文本框的新值。这并不像从服务器调用客户端来获取其中的内容那么容易,对吗?我需要客户推迟更改吗?

在动态数据中,有一种方法可以通过以下方法将控件的值绑定回实体:

protected override void ExtractValues(IOrderedDictionary dictionary)
{
    dictionary[Column.Name] = 
        ConvertEditedValue(HttpUtility.HtmlEncode(CKEditor.Text));
}

现在该值始终相同,它是我最初绑定到 CKEditor 控件的值:

protected override void OnDataBinding(EventArgs e)
{
    base.OnDataBinding(e);
    if (FieldValue != null)
    {
        CKEditor.Text = HttpUtility.HtmlDecode(FieldValueEditString);
    }
}

我该如何解决这个问题? :)

I was just playing around with ckeditor and can't get the darn thing to work for me. I somehow need to "data bind" the text box just before or at the same time of post back. How do I do that?

Loading the data is fine but when I click update I need to somehow retrieve the new value of the text box. It's not as easy as to call the client from the server to just get whatever is in there right? I need the client to push the changes back?

In dynamic data there is a method for binding the value of the control back to the entity in the following method:

protected override void ExtractValues(IOrderedDictionary dictionary)
{
    dictionary[Column.Name] = 
        ConvertEditedValue(HttpUtility.HtmlEncode(CKEditor.Text));
}

Now that value is always the same it's the value I originally bound to my CKEditor control:

protected override void OnDataBinding(EventArgs e)
{
    base.OnDataBinding(e);
    if (FieldValue != null)
    {
        CKEditor.Text = HttpUtility.HtmlDecode(FieldValueEditString);
    }
}

How do I solve this? :)

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

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

发布评论

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

评论(1

妖妓 2024-08-16 16:35:25

回发后,检查快速监视窗口中的Request.Form对象,看看是否可以获取那里编辑器的数据。我可以保证编辑器数据可以在Request.Form对象中找到。然后就可以拿出来使用了!

After postback check the Request.Form object in quick watch window and see if you can get the data of the editor over there. I can guarantee that the editor data could be found in the Request.Form object. Then you can take it out and use it !

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