在datalist中显示选定的网格行数据 [英] Show selected grid row data in datalist

查看:78
本文介绍了在datalist中显示选定的网格行数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gridview。当我点击gridview的特定行时,我想在datalist中显示那些行信息。我不想使用任何额外的选择按钮或其他东西来选择特定的行。只需点击一行网格。我该怎么做?



这可以是通过使用选定的索引更改的网格事件或任何其他事件来完成?

I have a gridview. When i click on a particular row of gridview,I want to display that rows information in datalist. I dont want to use any extra select button or something for selecting the particular row.Just click on the row of grid.How can i do this?

Can this be done by using selected index changed event of grid or any other event?

推荐答案

您好,



你可以使用JQuery附加一些Table或Div来显示详细信息。



添加Click事件:http://api.jquery.com/click/ [ ^ ]

附加DOM对象: http://api.jquery.com/append/ [ ^ ]
Hi,

You can use JQuery to Append some Table or Div to show the details.

Add Click Event : http://api.jquery.com/click/[^]
Append DOM Object: http://api.jquery.com/append/[^]


请参阅此链接 [ ^ ],您将在那里正确演示如何通过单击任何行而不使用自动生成的选择按钮来绑定数据列表视图。此外,您还可以访问此链接 [ ^ ]。
Refer the This Link[^], there you will be demonstrated properly that how to bind you data list view by clickin on any row without auto generated select button. Further you can also visit this link[^] also.


点击选择gridview所选行显示在datalist上。

As you click on select of gridview the selected row appears on datalist.
BookId Bookname Price
------Gridview-----
Select B1 Asp 1200
Select B2 Java 700
Select B3 C# 690
Select B4 PHP 659
Select B5 unix 865

---Datalist----
BookId: B3
Bookname: C#
Price: 690





使用两个sqldatasource控件,datalist的sqldatasource必须有参数化选择命令,然后设置select参数。示例显示了以下所有内容:





Use two sqldatasource control, sqldatasource for datalist must have parameterize select command, then set the selectparameters. Example shows every things below:

<form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"

            DataKeyNames="BookId" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="BookId" HeaderText="BookId" ReadOnly="True"

                    SortExpression="BookId" />
                <asp:BoundField DataField="Bookname" HeaderText="Bookname"

                    SortExpression="Bookname" />
                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"

            ConnectionString="<%


这篇关于在datalist中显示选定的网格行数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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