每次访问网站时使用 ASP.NET 和 XML
我有一个问题需要理解 ASP.NET 与每个客户端浏览器的概念。
当用户点击我网站上的特定页面时,我尝试更新服务器上的 XML。 该页面是动态的,但太大了,所以我希望它使用 XML 文件加载,而且当用户更改下拉列表中的值时,页面上有几个下拉菜单,我需要根据选择刷新数据,另外我的下拉菜单down 是一个自定义设计,这里我没有得到和 selectedIndex 更改事件。
因此,我使用 JQuery 获取下拉列表中更改后的值,并计划从 jQuery 读取 XML 并显示数据。
但由于 XML 是在服务器上的页面点击时更新的,我想知道,如果多个用户点击同一页面,数据会根据每个用户的选择显示,还是会混合数据并显示最后的点击记录。
I have a question to understand the concept of ASP.NET with each client browser.
I am trying to update the XML on server when a user hits a particular page on my website.
This page is dynamic, but too large so I want it to load using an XML file also I have several drop downs on the page when user changes the value in drop down, I need to refresh the data based upon the selection, additionally my drop down is a custom designed here I do not get and selectedIndex change event.
So I'm using JQuery to get the changed value in my drop down and planning to read XML from jQuery and display the data.
But since the XML is updated on hit of the page on server, I want know, if multiple users hit the same page, will the data displayed as per each users selection or it will mix the data and show the last hits record.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我没有弄错你的问题,你基本上会问以下问题:
这很大程度上取决于您如何使用该文件。一般来说,如果您每次尝试将该文件写入磁盘,用户将看到最后一次更新。基本上是从最后一个用户开始更新的。
但是,您可以同步对此文件的访问,在每个用户的基础上写入该文件,您将看到每个用户的输出:
更新:
对于匿名用户来说,这效果不佳。但是,如果您只需要存储当前用户的选择,则可以使用
SessionState
而不是 XML 文件。If I'm not mistaken about your question, you basically ask the following:
This greatly depends on how you are using that file. In general, if you try to write that file to disk each time, users will see the last update. Basically update from the last user.
However, you can synchronize access to this file, write the file on per-user basis and you will see a per-user output:
UPDATE:
For anonymous users this would not work well. However, if you need to store the selection only for the current user, you can use
SessionState
and not an XML file.我想介绍一种新方法来帮助我回答上述问题。
我在这里所做的是
在页面加载时,我们在不同的隐藏字段中添加了与每个部分相关的所有信息。
假设我有三个部分与我的自定义下拉菜单!
我们具体实现的是,单击自定义下拉菜单时,我们使用输入的分隔符将值与隐藏字段分开,并相应地显示数据,这是逻辑的一小部分,但它有助于显示数据而无需回发。
Jquery 对我的帮助很大,只需更改我的块的内部 html 即可。
I would like to introduce a new way that it helped me to answer my above question.
What i did here is
on Page load we added all the information related to each section in different hidden fields.
suppose i have three section with my custom drop down!
What exactly we implemented is that on click on my custom drop-down, we separated the values from the hidden field with the separator we entered and displayed the data accordingly, small part of logic but it helped in displaying the data without post back.
and Jquery helps a lot to me for just changing the inner html of my block.