Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a ComboBox to a DataGrid
Message
De
07/01/2004 14:15:15
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00863988
Message ID:
00864786
Vues:
15
Rich,

I'm not sure what would be the best way to do this. My first thought is to generate the column in the SQL query but I would need to test this approach. Maybe someone else can help with that question.

Regards,

Terry Carroll



>Terry,
>I thought I was ready to go on, but I discovered I have a "side" question first... On the DataGridBoolColumn...
>
>How would I do that if I wanted to tie it to the Northwind.Orders.ShipCountry field...
>display a checkbox Checked if Northwind.Orders.ShipCountry is not "USA"
>and unchecked if it is "USA"
>
>Thanks for being patient with me,
>Rick
>------------------------------
>>Rick,
>>
>>I too am a VFP developer climbing the learning curve of .Net. As a matter of fact I have only been working with it full time for 9 weeks so I’m by no means an authority but I am willing to help when I can. There are so many people on the forums that have helped me, and will help me in the future, so I want to give back.
>>
>>I have included a few lines of code that illustrates how to add a table style to a grid. The code should be added to a method in your form and then called after the forms call to InitializeComponent().
>>
>>In addition to defining the table style, you should know how to setup a combo box. Once you can worked with these two techniques it’s a snap to add the combobox with the Syncfusion class and I will be happy to assist you at that point.
>>
>>Happy .Net Programming
>>
>>Terry Carroll
>>
>>
>>
>>
>>   Public Sub SetGridTableStyles()
>>
>>        ' This is a sample that will display 3 columns in a grid with the defined properties
>>        ' set.
>>
>>        ' Int Table Style object
>>        Dim tsTableStyle As New DataGridTableStyle
>>        ' Set the name of the table to map to the style.
>>        tsTableStyle.MappingName = "Mail"
>>
>>
>>        ' For Each Column you want to display in the grid Init and
>>        ' set properties for a GridColumnStyle object.
>>
>>        ' Note there are other properties you can set
>>        Dim Col1 As New DataGridTextBoxColumn
>>        Col1.MappingName = "M_From"      ' Name of column to display
>>        Col1.HeaderText = "From"         ' Header
>>        Col1.Width = 50
>>        ' Add this column to the table style object tsTableStyle
>>        tsTableStyle.GridColumnStyles.Add(Col1)
>>
>>        Dim col2 As New DataGridTextBoxColumn
>>        col2.MappingName = "m_CoName"    ' Name of column to display
>>        col2.HeaderText = "Name Addressed To"      ' header
>>        col2.Width = 145
>>        tsTableStyle.GridColumnStyles.Add(col2)
>>
>>        ' Note there is a .Net framework style class for a check box. Only textbox and check box
>>        ' are natively supported in .Net for now anyway.
>>        'Example for checkbox
>>        Dim Col3 As New DataGridBoolColumn
>>
>>        Col3.MappingName = "m_nocharg"
>>        Col3.HeaderText = "NC"
>>        Col3.Width = 20
>>        Col3.AllowNull = False
>>        tsTableStyle.GridColumnStyles.Add(Col3)
>>
>>
>>        ' Add the table style to the Grid
>>        Me.grdNameOfGrid.TableStyles.Clear()
>>        Me.grdNameOfGrid.TableStyles.Add(tsTableStyle)
>>
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform