Click here to Skip to main content
15,898,975 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to skip a grid column on drop down select index..


if i select all it should display all Records , if i select list item depend on selection in drop down it should display grid skipping one column..I have taken a stored procedure if else block in else i have skipped a column and wrote stored procedure but that gives error seems i have to do it in another way..


How to skip a column in grid depending on drop down selection.??

help ??

suggestions??

What I have tried:

Stored procedure i have written if else statement skipping one column in else statement that gives column not found error.. how to do it..
Posted
Updated 3-Mar-17 22:22pm
v6
Comments
Mahesh2223 3-Mar-17 8:30am    
Cannot find what is wrong but grid is not displaying records on drop down selection
Jochen Arndt 3-Mar-17 8:45am    
Does your database contain recordsets where B.GroupCode == "GroupCode"?

Because that is what you are actually looking for according to the posted code snippets.
Mahesh2223 3-Mar-17 9:32am    
Yes It contains Records
Mahesh2223 3-Mar-17 9:34am    
My doubt is Stored Procedure Comparing with if please tell me whether the stored procedure is correct or not
Dave Kreskowiak 3-Mar-17 8:48am    
Looking at your code the problem isn't with the grid but with your database query. The grid is displaying everything your query is returning. Your first step is to figure out if the query works as expected and very it's returning everything you're expecting.

1 solution

In Search_Click you are calling
C#
BindGrid("GroupCode");
which means you are passing the value "GroupCode" to your stored procedure.

That forces the following query to run:
SQL
SELECT B.DoctorLastName + ', ' + B.DoctorFirstName AS DoctorName
    ,C.UpperLimit
    ,C.DownLimit
    ,C.isKMC
    ,C.KMCDOCCODE
FROM DoctorDetails B
INNER JOIN VRRatio C ON B.GroupCode = C.GroupCode
WHERE B.GroupCode = @GroupCode
I doubt very much your data actually has B.GroupCode = 'GroupCode'
Try changing your button code to
C#
BindGrid("ALL Groups");
or using a specific Group code that you know exists on your database
 
Share this answer
 
Comments
Mahesh2223 3-Mar-17 10:10am    
well i will try lik that
Mahesh2223 3-Mar-17 23:55pm    
Yes I have Changed the button code to All Groups its working fine..I have two blocks like if and else.. if is all groups else is depending on drop down selection.
Mahesh2223 3-Mar-17 23:56pm    
One is working fine but drop down selected is not working
CHill60 5-Mar-17 19:16pm    
I'm not sure what your new problem is. Can you give more specific info

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900