简体   繁体   中英

C# DataGridView automatically shorting when adding row in my datasource

I am developing flight booking engine in windows application.

dgv=DataGridView I am using DataGridView to show the flight details. I am shorting the dgv based on flight fare. If user click any row(flight) if that flight have any connecting ie) I want to go from "B" to "G". For that I have availablity like as follows

Flt 1 "B" to "C" Flt 2 "C" to "D" Flt 3 "D" to "G"

first I will show like follow

Flt 1 B->C->D->G Rs.5000

when user click that row I will add three row by hiding that row in order to show details of all flight. That time I dont want to short it at that time. pls tell me how to solve it

The best solution for this problem is not using the same grid for flights and flight details. You could nest your details in the cell you want it to sort with.

Ofcourse you could also just turn off sorting. Or if you really want to hack it you override the sort event with some custom sorting. But that is very prone to bugs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM