hide or remove a row from datagrid

S

Samson

I have a datagrid bound to an employee database table, which looks
something like this:

FirstName LastName PhoneNumber Email
---------------------------------------------
John Baggins 111-1111 (e-mail address removed)
Frodo Baggins 222-2222 (e-mail address removed)

I have a form that users use to get the results, and I'm trying to
hide some employees (rows) from being displayed (I have some employees
who don't want to be shown). Does anyone have any idea how to go with
this?
 
R

Raterus

Well, either restrict the rows based on your sql statement, or taint your results by removing rows from the datasource before binding them to the datagrid. Or you could inherit from the Ring Class, and invoke the "OneRingToRuleThemAll" method, that seems to fix all my problems, perhaps yours?
 
S

Saravana [MVP]

There various ways to do this,

1. You can do this at Database Layer, so that you will fetch only requried
records. (Recommended)

2. Doing filter at DataSource. For example if you datasource is dataset,
then you can filter dataset using Select or Find method. (If not 1 then 2)

3. When you bind the datagrid, during itemdatabound event. You can check for
condition and delete that item (not recommended)
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top