如何在网格视图中链接到数据 [英] how to make link to the data in grid view

查看:81
本文介绍了如何在网格视图中链接到数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:GridView ID="Gv1" runat="server" CellPadding="4" ForeColor="#333333" 

        GridLines="Both">
  <alternatingrowstyle backcolor="White" forecolor="#284775" />
  <editrowstyle backcolor="#999999" />
  <footerstyle backcolor="#5D7B9D" font-bold="True" forecolor="White" />
  <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
  <pagerstyle backcolor="#284775" forecolor="White" horizontalalign="Center" />
  <rowstyle backcolor="#F7F6F3" forecolor="#333333" />
  <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
  <sortedascendingcellstyle backcolor="#E9E7E2" />
  <sortedascendingheaderstyle backcolor="#506C8C" />
  <sorteddescendingcellstyle backcolor="#FFFDF8" />
  <sorteddescendingheaderstyle backcolor="#6F8DAE" />



我已经在后面的代码中实现了代码.但是我不知道如何使用后面的代码来建立链接..



i have implemented the code in code behind., but i dont know how to make the link to that using code behind..

推荐答案

您不需要链接aspx页面及其文件后面的代码. Visual Studio将为您执行此操作.

如果要从aspx页面触发事件,以便在后台代码中对其进行处理,只需将此事件添加到页面中.
You don''t need to link the aspx page and its code behind file. Visual Studio will do this for you.

If you want to fire an event from the aspx page so that it is handled in the code-behind, just add this event to your page.


<Columns>
        <asp:TemplateField HeaderText="Travels Name">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton3" runat="server" Text='<%# Eval("TRVLSNAME") %>'></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Dep Time">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton4" runat="server" Text='<%# Eval("DTIME") %>'></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Arr Time">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton5" runat="server" Text='<%# Eval("ATIME") %>'></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Bus Type">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton6" runat="server" Text='<%# Eval("BUSTYPE") %>'></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Price">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton7" runat="server" Text='<%# Eval("PRICE") %>'></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>


这篇关于如何在网格视图中链接到数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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