简体   繁体   English

C#DataGridView在我的数据源中添加行时自动短路

[英]C# DataGridView automatically shorting when adding row in my datasource

I am developing flight booking engine in windows application. 我正在Windows应用程序中开发航班预订引擎。

dgv=DataGridView I am using DataGridView to show the flight details. dgv = DataGridView我正在使用DataGridView来显示航班详细信息。 I am shorting the dgv based on flight fare. 我根据机票价格来做空dgv。 If user click any row(flight) if that flight have any connecting ie) I want to go from "B" to "G". 如果用户单击任何行(航班)(如果该航班有任何连接),即我想从“ B”转到“ G”。 For that I have availablity like as follows 为此,我有如下的可用性

Flt 1 "B" to "C" Flt 2 "C" to "D" Flt 3 "D" to "G" Flt 1“ B”到“ C” Flt 2“ C”到“ D” Flt 3“ D”到“ G”

first I will show like follow 首先,我将显示如下

Flt 1 B->C->D->G Rs.5000 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. 或者,如果您真的想破解它,则可以使用一些自定义排序来覆盖sort事件。 But that is very prone to bugs. 但这非常容易出现错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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