如何在第一个组合框的选择更改(数据库连接)时更新第二个组合框 [英] how to update the second combobox when first combobox's selection change(database connectivity)

查看:97
本文介绍了如何在第一个组合框的选择更改(数据库连接)时更新第二个组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows窗体中我有两个组合框首先是针对移动设备制造商,即诺基亚,三星,索尼和第二个组合框用于公司的模型,如诺基亚纯视图,三星s3,HTC一个,

i想要根据第一列的变化来改变型号,我的意思是当用户在combobox1中选择nokia时,那么combobox2将显示公司的模型,如诺基亚纯视图,6600,7610等等。 combobox,我不想保存模型没有。在组合框的列表中,我想使用与combobox的数据库连接,这样我就可以在列中更新新的即将推出的新模型,然后通过查看我可以将列与组合框绑定但是如何更改在combobox1中选择更改时的列

i使用组合框的选择更改事件和保存所有模型的字符串,但如果我想要更新模型我想要编辑它太搞笑了整个软件。所以我决定它应该在一个列中,以便我可以更新,但我不知道逻辑如何更改

抱歉我的错误解释我的英语很弱

i

 if之前使用过这个(samsung== comboBox1.SelectedItem.ToString())
{
comboBox2.Items.AddRange(samsung) ;
}
else if(apple== comboBox1.SelectedItem.ToString())
{
comboBox2.Items.AddRange(apple);
}

解决方案

以下是详细指南:使用jQuery和ASP.NETCascading DropDownLists [ ^ ]



我在这里写了一些关于数据绑定的内容: Depends4Net - Part 2 [< a href =http://www.codeproject.com/Articles/247687/Depends4Net-Part-2target =_ blanktitle =New Window> ^ ]



最好的问候

Espen Harlinn


in windows forms i have two comboboxes first is for mobile manufacturer i.e nokia,samsung,sony and second combobox is for company''s model like nokia pure view, samsung s3, htc one,
i want to change the model number as per the changes will happen to the first column, i means when user select nokia in the combobox1 then the combobox2 will show the company''s model like nokia pure view, 6600,7610 etc etc from the next combobox, i dont want to save the model no. in the combobox''s list i want to use the database connectivity with combobox so that i can update the new new upcoming model in the column then it will be easy so by reviewing i can bind the column with the combobox but how can i change the column when selection is change in combobox1
i prieously used the selection change event of the combobox with the strings saving all the models, but it is too hilarious that if i want to update the model i want to edit the whole software. so i decided it should be in a column so that i can update that but i dont know to logic how to change
sorry for my bad explanation i am weak in english
i have used this before

if ("samsung" == comboBox1.SelectedItem.ToString())
           {
               comboBox2.Items.AddRange(samsung);
           }
           else if ("apple" == comboBox1.SelectedItem.ToString())
           {
               comboBox2.Items.AddRange(apple);
           }

解决方案

Here is a detailed guide: Cascading DropDownLists with jQuery and ASP.NET[^]

I''ve written a bit about databinding here: Depends4Net - Part 2[^]

Best regards
Espen Harlinn


这篇关于如何在第一个组合框的选择更改(数据库连接)时更新第二个组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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