Dropdown List in a DataGrid

Discussion in 'ASP .Net Web Controls' started by John Doe, Jun 27, 2003.

  1. John Doe

    John Doe Guest

    Hi everyone,

    I want to display one of the fields in My datagrid as a dropdownlist box....

    I have created a DataSet that contains 2 tables, one parent and one child, I
    have also created a Relationship between these tables in my dataset.

    I am using a Column Template to diplay the data for the field I wish to be
    displayed in the dropdownlist, but i have not been able to map the data from
    my lookup table into the list, when I run the application all I get is an
    empty dropdownlist !?!?

    I have attempted to set the DataMember, DataTextField & DataValueField
    attributes of my Control, but all to no avail!

    Can anyone give me a few pointers as to what I am doing wrong ?


    Test Data

    Dim oMytable As New DataTable("Main")

    oMytable.Columns.Add(New DataColumn("NO"))

    oMytable.Columns.Add(New DataColumn("DATE"))

    oMytable.Columns.Add(New DataColumn("TYPE"))

    ....... next is the code that populates the main table

    oDataSet.Tables.Add(oMytable)

    oMytable = New DataTable("Lookup")

    oMytable.Columns.Add(New DataColumn("TYPE"))

    oMytable.Columns.Add(New DataColumn("ESCRIP"))

    ....... next is the code that populates the lookup table

    oDataSet.Tables.Add(oMytable)

    oDataSet.Relations.Add("AccLink", oDataSet.Tables("Lookup").Columns("TYPE"),
    oDataSet.Tables("Main").Columns("TYPE"))

    This DataSet is then Bound to my DataGrid
     
    John Doe, Jun 27, 2003
    #1
    1. Advertising

  2. John Doe

    Ingeborg Guest

    Hi.

    I am not sure why your code is not working, I program in
    c#.

    Anyway, a link you might find useful:

    http://msdn.microsoft.com/library/default.asp?
    url=/library/en-
    us/dv_vstechart/html/vbtchTopQuestionsAboutASPNETDataGridSe
    rverControl.asp


    Ingeborg
     
    Ingeborg, Jun 28, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vishnu
    Replies:
    1
    Views:
    1,213
    Patrick.O.Ige
    Mar 25, 2006
  2. Mike
    Replies:
    1
    Views:
    810
  3. acadam
    Replies:
    0
    Views:
    758
    acadam
    Dec 27, 2006
  4. Replies:
    2
    Views:
    438
  5. Steve Myers
    Replies:
    2
    Views:
    276
    Steve Myers
    Nov 20, 2003
Loading...

Share This Page