在asp.net中旋转Gridview [英] pivoting Gridview in asp.net

查看:89
本文介绍了在asp.net中旋转Gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的GridView结果的格式如下: -





但是我需要输出格式如下: - $ / $>
$ b



停顿应该自动增加(即如果有是4站,它应该在网格视图中显示4站)。



我的Gridview代码: -

 < asp:GridView ID =grdFlightInforunat =serverAutoGenerateColumns =false> 
<列>
< asp:BoundField DataField =AirlinesNameHeaderText =AirlinesName/>
< asp:BoundField DataField =TotalNetFareHeaderText =NetFare/>
< asp:BoundField DataField =停止HeaderText =停止/>
< /列>
< / asp:GridView>

预先致谢。

解决方案

如果您在DataGrid中使用DataSource,您可以使用 DataBinding 事件

  OnDataBinding 

在这里您可以编写您的自定义代码以根据停靠点数量递增



Codeproject上有一篇很好的文章,详细描述了如何做到这一点

详细的数据绑定教程



同样在MSDN上


My Gridview Results comes in following the format:-

But I need output in following format:-

Stops should increase automatically (i.e. if there are 4 stops, it should show 4 stops in the Grid View).

My Gridview Code:-

  <asp:GridView ID="grdFlightInfo" runat="server" AutoGenerateColumns="false">
    <Columns>
        <asp:BoundField DataField="AirlinesName" HeaderText="AirlinesName" />
        <asp:BoundField DataField="TotalNetFare" HeaderText="NetFare" />
        <asp:BoundField DataField="Stops" HeaderText="Stops" />
    </Columns>
</asp:GridView>

Thanks in advance.

解决方案

If you are using DataSource with your dataGrid you can use DataBinding Event

OnDataBinding

here you can write your custom code to increment according to the stops number

there is a good article on Codeproject that describes how to do this in details

A Detailed Data Binding Tutorial

Also on MSDN

这篇关于在asp.net中旋转Gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆