RadGrid 或 GridView 与报告的业务实体不匹配
我正在 ASP.NET 中创建报告。 我正在检索的业务对象包含我需要的所有信息,但我不能只是对其进行 DataBind(),因为报表不仅仅显示业务实体。 我需要以某种方式排列列,对每行进行一些计算并手动添加列,另外我需要在每行中有一个复选框,这些选中的行将在下面的单独图表中使用。
我的问题是如何从业务实体的集合到报告。 我打算创建一个新类来按照报告所需的方式存储信息(我将循环访问业务实体并使用新类将它们转换为新结构)。 或者我只是想使用 DataTable 以正确的格式/顺序获取信息。 这是正确的方法吗? 如果没有,那什么更好呢?
顺便说一句,如何手动向 Telerik RadGrid 添加行和列? 由于上述原因,我对 DataBind() 不感兴趣。
I'm in the process of creating a report in ASP.NET. The business object that I'm retrieving contains all the information I need, but I can't just DataBind() it because the report isn't simply displaying the business entities. I need to arrange the columns in a certain way, do some calculations for each row and manually add columns, plus I need to have a checkbox in each row and those checked rows will be used in a separate chart below.
My question is how to go from the collection of business entities to the report. I was going to either create a new class to store the information the way I need for the report (I would loop through the business entities and transform them into the new structure using the new class). Or I was simply going to use a DataTable to get the information in the right format/order. Is that the correct approach? If not, what's better?
As a side note, how do you manually add rows and columns to a Telerik RadGrid? I'm not interested in DataBind() for the above reasons.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我创建了一个数据表,其中包含正确的列。 然后我循环遍历业务实体并将我需要的内容转换到数据表中。 然后我将 DataTable 绑定到网格。 效果很好。
I created a DataTable with the right columns in it. Then I looped through the business entities and transformed what I needed into the DataTable. Then I bound the DataTable to the grid. Worked well.