Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Dropdown List in a DataGrid

Reply
Thread Tools

Dropdown List in a DataGrid

 
 
John Doe
Guest
Posts: n/a
 
      06-27-2003
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






 
Reply With Quote
 
 
 
 
Ingeborg
Guest
Posts: n/a
 
      06-28-2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
1 Gridview. Dropdown A is column from database, Dropdown B is column from database, Data in A and B must be from same row. anonymoushamster@gmail.com ASP .Net 2 11-07-2007 12:40 PM
ajax cascading dropdown: second dropdown disabled acadam ASP .Net 0 12-27-2006 10:59 AM
bind a dropdown in a column in a datagrid based on the dropdown value selected in another column of the datagrid. vishnu ASP .Net 1 03-25-2006 01:24 PM
How to add a Dropdown list to a datagrid at runtime (dynamic) without using template columns in ASP.NET and still have the ability to us the datagrid Update event. Daniel Roth ASP .Net Datagrid Control 0 04-05-2005 03:58 AM
Select dropdown box bleeds into Javascript dropdown menu Mike HTML 1 12-18-2003 09:49 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57