在一个页面上的多个GridView的 [英] Multiple GridViews on one page

查看:501
本文介绍了在一个页面上的多个GridView的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建在C#中的应用程序。我创建了一个网页,其中有5个环节。每个链接打开一个不同的页面,其中有一个的GridView

I am creating an application in C#. I have created a page in which there are 5 links. Each link opens a different page where there is a GridView.

我可以在一个页面上所有的网格 - 也就是当我点击链接1 ,那么只有对应于该链接的电网将出现在页面上,当我点击在链接2 ,则仅出现在网格链接2 ?只有电网的激活链接应该是可见和所有其他网格被隐藏。

Can I make all these grids on one page - i.e. when I click on link1, then only the grid corresponding to that link will appear on the page and when I click on link2, then only the grid for link2 appears? Only the grid for the activated link should be visible and all other grids are hidden.

有人可以帮助我,我应该如何或在哪里开始呢?

Can someone help me in how or where I should start?

推荐答案

,多视点控制会做你wonders.Declare MultiView控件为每个gridview.Hope这可以帮助不同的看法。

Since you specified webforms in your tag,the multiview control will do you wonders.Declare a multiview control with different views for each gridview.Hope this helps.

用法

标记

 <form id="form1" runat="server">


    <asp:LinkButton ID="LinkButton1"  Text="Link1" runat="server" OnClick="LinkButton1_Click">LinkButton</asp:LinkButton>
    <br>
    <asp:LinkButton ID="LinkButton2" runat="server" Text="Link2" OnClick="LinkButton2_Click">LinkButton</asp:LinkButton></br>

<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">

    <asp:View ID="View1" runat="server" >

        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>

    </asp:View>

      <asp:View ID="View2" runat="server">
      <asp:GridView ID="GridView2" runat="server">
    </asp:GridView>
</asp:View>
</asp:MultiView>

</form>

code背后

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        //retrieve data
        GridView1.DataBind();
        MultiView1.ActiveViewIndex=0;
     }


    protected void LinkButton2_Click(object sender, EventArgs e)
    {
         //retrieve data
        GridView1.DataBind();
        MultiView1.ActiveViewIndex=1;
    }

这篇关于在一个页面上的多个GridView的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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