如何串联两个下拉菜单?

问题描述:

我花了两个dropdopdown年龄

这是我的恭喜

i take two dropdopdown for age

here is my concatnation

Convert.ToInt32(ddlAgeFrom.SelectedValue) + Convert.ToInt32(ddlAgeTo.SelectedValue)



我想像18到25一样存储在我的数据库中,我该怎么做



i want to store in my database like 18 to 25 how can i do that

试试这个

Try this

string ageRange = string.format("{0} to {1}", ddlAgeFrom.SelectedValue, ddlAgeTo.SelectedValue);

//push ageRange to DB now 


您可以将两个字段之间用至"连接起来.
可以在ASP.Net或数据库级别上完成此操作,具体取决于您要在何处放置此逻辑.
You can concatenate the two fields with a "to" between them.
This can be done both at the ASP.Net or database level, depending on where you would want to place this logic.