从表格到ASP.NET应用程序表单的关联选择 [英] Associative selection from the table in to ASP.NET application form

查看:59
本文介绍了从表格到ASP.NET应用程序表单的关联选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非规范化形式的表名为类别分类,其中我有4个字段,如类别,子类别,品牌和公司。我想在asp.net上开发一个搜索条件,其中的场景是:



*如果我从下拉列表中选择类别,它应该自动显示子类别在子类别的下一个下拉列表中与所选类别相关联。



*同样适用于该品牌。如果我选择子类别,网格应该显示所选子类别的相关品牌的复选框。



附上所述标准的屏幕截图。



我尝试了什么:



[删除重复信息]



我需要非规范化数据库背后的逻辑,例如Microsoft excel具有我需要在asp.net上实现的功能。

I have one table in a de-normalized form Named 'Category Classification' in which i have 4 fields like Category, Subcategory, Brand and Company. I want to develop a searching criteria on asp.net in which the scenario would be:

* If i select category from the drop down, It should automatically show the subcategories associated with that selected category in the next drop down of the subcategory.

* Same goes for the brand as well. If i select the subcategory, The grid should appear with the check boxes of the related brands of that selected subcategory.

The screen shot of the said criteria is attached along.

What I have tried:

[removed duplicate information]

I need the logic behind the denormalized database like Microsoft excel has that functionality which i need to implement on asp.net.

推荐答案

sql非常简单。



绑定第一个下拉列表的sql类似于:

The sql is pretty straightforward.

The sql to bind the first dropdown would be something like:
SELECT DISTINCT category
FROM [Category Classification]
ORDER BY category





第二个的sql将是



The sql for the second one would be

SELECT DISTINCT Subcategory
FROM [Category Classification]
WHERE Category = @Category -- pass in the currently selected category
ORDER BY Subcategory





这些通常被称为cascad下拉菜单有多种方法可以做到这一点,所以如果你遇到困难,你可能想要谷歌一些例子。



These are often referred to as cascading dropdowns and there are many ways to do them so you may want to google for some examples if you are stuck.


这篇关于从表格到ASP.NET应用程序表单的关联选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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