Scenario: I have 2 gridviews, clientgridview for showing the clients and the projectgridview for showing the projects. If I Click on the Client name on the the clientgridview i will be directed to the project gridview to show the different projects of the client

Problem: when i click on the name of my client, projectgridview displays all the projects that are stored on my database. I need to display only the projects that are associated to the selected client(ProjectId is the PK in m ProjectTable and is FK in ClientTable).

Can anyone help me get the corrent syntax to filter the projectId...
SELECT * FROM Project WHERE ProjectId=@Project;
I used this syntax and it didnt work..hope you guys can figure out how to filter this correctly..

Recommended Answers

All 6 Replies

hi,
in projects table there should be a coloumn like clientid.so if u click on client naem just pass client id.and write query like this

select * from project where clientid=@clientid

...so this will filter the projects according to client.hope this wil help you,.thanking you.

hi there..
thanks for the reply but unfortunately it didnt work for me..i believe there still a code that needs to be added on the selecting event of the datasource(that's only my opinion) but if you guys have some different idea aside from using a sql syntax please feel free to reply in this post...thanks

hi,
can u post ur code ,so that we can understand what u r trying to do.
thanking you,

Member Avatar for rajarajan2017

Ur coding is right!, but you need to pass the correct client id to the variable @project, I want to know the structure of your master and child table.

hi srikanthkadem....
my problem is already resolved, thanks for trying to help i appreciate it.. i already figured it out through tutorials in the web... till next time..:)

hi rajarajan07...
thanks for replying but i already got a solution to the problem.. i only set some of the properties of the gridview to make it work...till next time..:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.