构建动态可编辑矩阵 - ASP.NET

发布于 2024-09-07 09:00:54 字数 328 浏览 11 评论 0原文

场景:

我正在构建一个灵活的折扣组件,可以针对不同类型的产品(经过经济状况测试)为不同类型的客户指定折扣。折扣类别、产品类型和折扣率都是由用户配置的,理想情况下,我希望用户能够在单个屏幕上查看和编辑折扣关系,即左侧的产品类型,左侧的折扣类别顶部,指定的折扣率显示在相应的“单元格”中。

我正在尝试找到以表格格式显示这些数据的最佳解决方案。中继器似乎不符合要求,数据网格/列表控件也不符合要求。我能想到的唯一选择是使用循环在服务器端动态构建 HTML 并输出到文字控件,或者通过将序列化数据(以 XML 格式)发送回客户端并使用 JavaScript 再次动态构建矩阵。

任何其他想法将不胜感激。

Scenario:

I am building a flexible discounting component, whereby discounts can be specified for different types of customers against different types of products (means tested). The discount categories, product types and discount rates are all configurable by the user and ideally I would like the user to be able to view and edit the discount relationships on a single screen i.e. Product Types down the left-hand side, Discount Categories along the top, with the assigned discount rate displayed in the corresponding "cell".

I am trying to find the best solution for displaying this data in tabular format. A repeater does not seem to fit the bill, nor does the data grid/list controls. The only option I can think of is to construct the HTML dynamically either server-side using loops and outputting to a literal control, or by sending the serialized data (in XML format) back to the client and using JavaScript to again dynamically build the matrix.

Any other ideas would be appreciated.

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

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

发布评论

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

评论(1

萌逼全场 2024-09-14 09:00:54

如果您动态生成要显示的列,GridView 就可以工作。由于您需要完全控制,因此服务器端表控件在这里也可以很好地工作,因为您可以通过编程方式创建每一行/列。您必须在每次页面加载时创建它,但 VIewState 会在事后恢复内容...

根据复杂程度,我确实认为您也可以使用中继器或 ListView 来处理这种情况...

HTH。

Well, GridView would work if you dynamically generate the columns to display. Since you need full control, a server-side table control would work great here too, because you can programmably create each row/column. You'd have to create it on every page load, but VIewState will restore the contents after the fact...

Depending how complex, I do think you could get a repeater or ListView to work for this scenario too...

HTH.

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