Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a dataset for a drop-down list
Message
 
 
À
27/10/2008 21:10:02
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01356963
Message ID:
01357985
Vues:
15
Bonnie,

Thank you very much for your help.

>Hey Dmitry,
>
>Pretty easy really, as I'm sure you'll see once you look it up. You have two options, a new DataView, or the DefaultView of your current DataTable.
>
>
>DataView MyView = new DataView(this.MyDataSet.Tables["MyTable"]);
>// -- or --
>DataView MyView = this.MyDataSet.Tables["MyTable"].DefaultView;
>
>
>Then, set up the filter and set your DropDown's DataSource (I'm not sure what else needs setting, this is a web dropdown, and as you know, I'm not that web-savvy):
>
>
>MyView.RowFilter = "the filter expression";
>MyDropDown.DataSource = MyView;
>
>
>~~Bonnie
>
>
>
>
>
>>Hi Bonnie,
>>
>>This is how I approached the same task in VFP; loading the entire list of Buildings into a cursor and then filter it based on the user selection of Site. I will try to find an article on the web teaching how to filter DataView. I am jumping from .NET to VFP all the time and not very much up on how to do things in .NET.
>>
>>Thank very much for your suggestion.
>>
>>>I'd also use a DataView of your Buildings DataTable instead of the DataTable itself for you Buildings drop-down, that way it's easy to filter it in the Site drop-down's event handler.
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>
>>>
>>>>Hi,
>>>>
>>>>I have a drop-down list of Buildings on a web page. Currently a dataset of buildings is created in the PAGE_LOAD method. Then (still in the PAGE_LOAD) the drop-down list is bound to the dataset.
>>>>
>>>>Now I need to add a Site drop-down list and in the Building drop-down list view only buildings that belong to a site (after user selects a site). Building table has SITE_NO field so that based on the user selection of Site drop-down I can determine which buildings to retrieve from the Buildings table. My question is what method should I use to create a dataset of buildings and bind it to the Building drop-down? I suppose this should be done in one of the methods of the Site drop-down, right? Which one?
>>>>
>>>>Any suggestions would be greatly appreciated.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform