Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Greetings Experts!

Problem :

While filtering the GridView, I need to show only 5 fields in GridView (using VB.NET) from the table having arround 20 fields.

Current Situation:

I have a table in MS SQL DB 'tbl_Address' which contains detailed address of customer and has arround 20 fields in it.

I am able to fetch the information as I want during the page load. But when I try to apply filter and reload the table data, it shows entire 20 columns in the gridview.

Could you please suggest me how should I achieve what I want?
(..Using any best and convinient way I want to acheve it..)

Your replies are appreciated in advance!

Thank you very much.

G Nachiket
Posted

1 solution

In this case you can remove the columns by using DataTableCollection.RemoveAt function in front-end or you can limit the number of columns in database itself.


I'll suggest you to go through following links:
A Practical Guide to .NET DataTables, DataSets and DataGrids - Part 2[^]
MSDN : DataTableCollection.RemoveAt Method[^]


--Amit
 
Share this answer
 
Comments
Nachiket G 3-Aug-12 8:40am    
I appreciate your answer Amit.

I am not able to limit the number of columns because I am trying to provide some special filtering facility for user.
- I need user to be able to apply filter on the fields which are not being displayed.

I will soon try the solutions (two links) given by you.

Thanks.

G Nachiket
Member 10986028 16-Aug-14 5:08am    
filtering my datagirdview with textbox mail me :inthiyaz.target@gmal.com

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