| |

VerySource

 Forgot password?
 Register
Search
View: 1977|Reply: 14

Can rows be hidden in the DataGrid?

[Copy link]

5

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-2-21 09:30:01
| Show all posts |Read mode
let him
Reply

Use magic Report

0

Threads

64

Posts

45.00

Credits

Newbie

Rank: 1

Credits
45.00

 China

Post time: 2020-4-29 22:30:02
| Show all posts
dg1.Items [0] .Visible = false;
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 United States

Post time: 2020-4-30 19:00:02
| Show all posts
Filter rows that are not displayed with dataview
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Poland

Post time: 2020-4-30 21:45:02
| Show all posts
can
Reply

Use magic Report

5

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-5-1 00:45:02
| Show all posts
Can't write like this, report error
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-5-1 20:30:02
| Show all posts
There can be two methods written in ItemDataBound: e.Item.Visible = false;
Or just write dgrd.Items [i] .Visible = false; i is the line you want to hide.
I am also a beginner and I do n’t know if I can help.
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-7 18:15:01
| Show all posts
public void RowHide (int j)
    {
        for (int i = 0; i <datagrid.Items.Count; i ++)
        {
            if (i! = j)
                datagrid.Items [i] .Visible = false;
        }
    }

Note that j is the index of the row you selected, the row is not hidden, all other rows are hidden
Reply

Use magic Report

0

Threads

27

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-5-7 19:00:01
| Show all posts
The method upstairs will do.
dgrd.Items [i] .Visible = false; use this when you know which line to hide,
Use dataview to filter rows that are not displayed when you know the hidden conditions
Reply

Use magic Report

0

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-15 06:15:01
| Show all posts
Come learn!
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-5-17 19:30:01
| Show all posts
hide. . .
I think so. If you are using datasource = datatable method.
Then delete the datatable. datatable.Rows.RemoveAt (index)
Copy the datatable one before the operation for possible recovery.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list