服务器端犯规看到客户端的变化 [英] Server side doesnt see changes on client side

查看:127
本文介绍了服务器端犯规看到客户端的变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如果这是正常的。我想补充一个选项,使用jQuery一个选择。当我保存一个asp按钮,我没有看到Click事件在服务器端的变化。

I'm wondering if it's normal. I add an option to a select with jQuery. When I save with an asp button, I don't see the changes on the server side in the click event.

和HTML是正确的后,我添加的选项。

And the HTML is all correct after I add the option.

它是一个编码问题还是我不​​懂的东西? :P

Is it a coding problem or I don't understand something? :P

$(selectCourant)
             .append($("<option></option>")
             .attr("value",$(dropdown).val())
             .text($(dropdown + " option:selected").text())); 

感谢您

ASP.NET和vb.net

ASP.NET And vb.net

推荐答案

是的,你不明白的东西。

Yes you did not understand something.

什么是客户端的Web浏览器端发生不通知服务器 - 除非你做额外的code和做编程

What's happens on client web browser side is not inform the server - except if you make extra code and do that programmatically.

服务器端不知道,幽冥阅读DOM(HTML结构)即使他想这么做,他也无法读取。

Server side did not know, nether read the dom (html struct) and even if he wish to do it, he can not read it.

一个解决方案是用一个岗位价值寄回。例如,当你增加一个选项,也是其他值添加到隐藏的输入和后回你的行动到服务器端。那么你是负责任阅读本价值观,理解他们,更新code后面的数据。

A solution is to send it back with a post value. For example, when you add an option, also add an other value to a hidden input and post back your action to the server side. Then you are responsibly to read this values, understand them and update your data on code behind.

背后不但不知道什么客户端发生了,也根本不知道什么是一样做,页面已经发后,回来与后回来,来这里的视图状态code。 codebehind节省了大部分视图状态的信息(除非你禁用的控件,或对页)要记得修改。然后在回发视图状态发送到code后面,后面去code将其code和知道后回之前什么都做。

Code behind not only do not know whats happens on client, but also do not know what's the same do, after the page have been send and come back with a post back, and here comes the viewstate. Codebehind saves most of informations on viewstate (except if you disable it on controls, or on pages) to remember that changes. Then on post back the viewstate send to code behind, and code behind decode it and knows what have done before the post back.

要讲几句。
当你prepare和渲染的HTML页面,你把所有的HTML结构浏览器客户端和浏览器渲染页面。当浏览器做回发到服务器上什么岗位,这样服务器仅知道该回来并使用此信息的信息与新的HTML结构重播只发回的变量。

To say few words more. When you prepare and "render" the html page, you send all html struct to the browser client , and browser render the page. When browser make a post back to the server sends only whats on the post back variables so the server knows only that informations that come back and use this informations to replay with a new html struct.

这篇关于服务器端犯规看到客户端的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆