什么是为UI存储数据的最佳方法 [英] what is the best way to store data for UI

查看:67
本文介绍了什么是为UI存储数据的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个应用程序,页面上将显示多个项目.对于每个项目,都会有很多信息.数据是在.aspx.cs后面的代码中完全生成的,并显示在ui中.

I am doing an application where there will be multiple items displayed on a page. for each item there will be lot of info. The data is completly generated in the code behind .aspx.cs and displayed in the ui.

当用户将鼠标悬停在特定项目上时,除了可见元素外,我还需要后面代码中的一些其他信息来获取该项目.现在,我正在使用管道将其存储在隐藏的div中来存储大量信息.

When the user mouseover particular item , apart from visible elements i need some other info from the code behind to grab for that item. Right now i am storing lot of info with pipe separated in a hidden divs.

当用户将鼠标悬停在某个项目上时,我转到该div的上下文并获取隐藏的值并显示一些弹出窗口.所有信息都作为客户端上的对象.

When the user mouseovers a item , i go to the context of that div and get the hidden values and show some popups..I just want to know if this is the right approach or if there is any other nice way of storing all the info as a object on the client side.

我正在UI端使用jquery.

I am using jquery on the UI side.

推荐答案

您可以将数据存储在JavaScript对象中.在后端生成JSON并在客户端进行解析(或将其作为文字直接分配给变量).

You can store your data in a JavaScript object. Generate JSON on the back-end and parse it (or simply assign it as a literal to a variable) on the client side.

这篇关于什么是为UI存储数据的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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