如何:数据库中的下拉列表值? [英] How to: a dropdownlist value in database?

查看:116
本文介绍了如何:数据库中的下拉列表值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cp pls中有人可以告诉我如何实现下拉列表并将其发送到视图。此外,存储并保存所选值。我几个月来一直在争吵。

Can someone in cp pls show me how to implement a dropdownlist and send it to view. Also, storing and save the selected value. I have been battling on this for months.

推荐答案

为什么不查询它并将其存储在你的表类列表中,如

列表< admin> admins_CBOx =新列表< admin>();

并将其绑定到组合框,例如

Combobox1.DataSource = admins;



并使用组合框活动中的selectedvalue事件



并在那里使用方法类似



Combobox1.selectedValue =你的一些变量并做你想做的事情



既然你选择了SeletedValue就需要了只需从表类创建另一个valiable,例如



admin TempadminCBBOX = Combobox1.SelectedValue;



和你得到你在组合框中选择的东西;



欢呼!
why don't you query it out in and store it in the list of your table class like
List<admin> admins_CBOx = new List<admin>();
and bind it to combobox like
Combobox1.DataSource = admins;

and use selectedvalue event from combobox event

and use there methodlike

Combobox1.selectedValue = some of your variable and do what ever you want to do with it

Since you SeletedValue got everthing you need just create another valiable from a table class like

admin TempadminCBBOX = Combobox1.SelectedValue;

and you got what you selected in combobox;

Cheer!


这篇关于如何:数据库中的下拉列表值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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