Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Shaped Entities
Message
 
À
19/12/2008 10:42:46
Tegron Tegron
Platinum Technologies
Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Versions des environnements
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01368835
Message ID:
01368913
Vues:
20
Tegron,

If I understand what you're trying to do correctly, the easiest way to show names instead of codes in a grid is to change the cell type to DataGridViewComboBoxColumn. You will have to set the values for the combo box in code. Sample code is listed below.
            DataGridViewComboBoxColumn dgvccMyColumnName = (DataGridViewComboBoxColumn)grdContactPersonal.Columns["MyColumnName"];
            dgvccMyColumnName.DataSource = oLookupBizObject.GetCurrentDataSet().Tables["MyTableName"];
            dgvccMyColumnName.ValueMember = "CodeColumn";
            dgvccMyColumnName.DisplayMember = "DescriptionColumn";
The other thing you can do is to create a separate table using the same entity that can have a slightly different structure, such as using a stored procedures that returns a dataset that includes the description column from the cross-referenced table. When you reference those fields, you will have to include the table name in the binding source member. The binding source would still be your regular business object but the binding source member would be TableName.ColumnName.

To create the table, rather than having a method that returns a DataEntity, your method fills in the values for the table.
            this.FillDataSet(this.GetCurrentDataSet(), "StoredProcedureName", "TableName");
            return this.GetCurrentDataSet();
It took me a while to get used to this but it works quite well and has a lot less overhead than creating a custom entity object. I hope this helps.


>Can anyone provide the exact way to setup and use a different shaped entity? The documentation is very vague regarding this area. The doc shows how to get items into the entity and how to create a new entity object, but it does not show how to use the different shaped entity with the business object.
>
>I want to use the different shaped entities in grids that displays the names instead of the coded values. I am thinking the shaped values will allow me to use any type of stored proc that I would like with a business object instead of being limited by the default entity for the business object. If anyone has any other suggestions, I would appreciate it.
Linda Harmes
HiBit Technologies, Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform