Gridview with more than 2 tables

E

egsdar

Hello. I'd like to know how can use in a Gridview more than two tables and
when I hit the update button should display for the child table a
dropdownlist instead of a textbox?


How can i do this two things? Best regards and thanks in advance for the help.
 
E

egsdar

I'm really thankful. It works, but I'm really sorry but now i have this:

Table A:
ID Resource IDgroup
1 Callcenter 2

Table B:
IDgroup Description
1 Human Resources
2 Networking


And with your help, when I hit edit, it displays the content with the
dropdown list as it should be and I'm able to update it, but after that it
displays back the content of table A. Is there a way that in normal mode i
can display the grid like this:

Gridview:
ID Resource IDgroup
1 Callcenter Networking

Thanks again.
 
G

Guest

I'm really thankful. It works, but I'm really sorry but now i have this:

Table A:
ID     Resource    IDgroup
1      Callcenter   2

Table B:
IDgroup   Description
1            Human Resources
2            Networking

And with your help, when I hit edit, it displays the content with the
dropdown list as it should be and I'm able to update it, but after that it
displays back the content of table A. Is there a way that in normal mode i
can display the grid like this:

Gridview:
ID     Resource    IDgroup
1      Callcenter   Networking

Thanks again.

it's a matter of your request, if you said "IDgroup" it shows "2"
because this is the value from IDgroup field. To show Description
value from another table you need to join that table.

For example, look at the article I sent you. There is a request like

<asp:SqlDataSource ID="..." Runat="server"
SelectCommand="SELECT ...."
ConnectionString="<%$ ConnectionStrings:NWConnectionString %>">

You would need to change that SelectCommand as

SelectCommand="SELECT a.ID, a.Resource, a.IDGroup, b.DESCRIPTION
FROM tableA a, TABLEB b
WHERE a.IDGroup=b.IDGroup"
 
E

egsdar

I'm going throguh a learning process with ASP.net and I'm really thankful
with your support and patience. After all it works.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top