选择网格视图行时,该行数据将显示在另一个网格视图中 [英] While select the gridview row that row data display in another gridview

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

问题描述

选择行数据显示在另一个gridview中的gridview行时

While select the gridview row that row data display in another gridview

推荐答案

您好.
问问题时应该知道的一件事,就是应该正确地问问题.

无论如何,我正在为您的问题提供解决方案.试试这个:

选择第一个gridview的行数据并将其存储在另一个数据表中,然后将此数据表定义为另一个gridview的数据源...

一切顺利.
Hi there.
One thing you should know while asking questions that you should ask the questions properly..

Anyway I am having a solution for your question. Try this:

select the rows data of the first gridview and store it in another datatable and define this data table as datasouce of another gridview...

all the best..


解决方案

首先,在gridview命令按钮中添加Linkbutton并赋予id ="lk"

现在选择gridview事件rowdatabound,如下所示..

Solution

First of all add Linkbutton in gridview commandbutton and gave id="lk"

Now select gridview event rowdatabound like follow code..

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton lk = (LinkButton)(e.Row.Cells[4].Controls[0]);
            e.Row.Attributes["OnClick"] = ClientScript.GetPostBackClientHyperlink("lk");

        }
    }



步骤3 ..
像在ur aspx页面中添加以下内容一样,添加EnableEventValidation ="false"



Step 3..
add EnableEventValidation="false" like following in ur aspx page

<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="Default2.aspx.cs" Inherits="Default2" %>



步骤4.现在,在gridview所选索引上编写代码,当您从一个gridview中选择行时,它将显示第二个gridview数据


谢谢



Step 4. Now write code on gridview selected index it will show data 2nd gridview when u select row from one gridview


Thanks


您好DG,您是否尝试使用在第一个GridView中单击的数据填充第二个Gridview?
该方案如下:
单击GridView1中的一行,然后使用该行中包含的数据填充第二个GridView?

这是您要达到的目标吗?
Hi DG, are you trying to populate a second Gridview, with the data that you have clicked on in the the first GridView?

The scenario is as follows:
Click on a row in GridView1, the data contained in this row is then used to populate a second GridView?

Is this what you are trying to achieve?


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

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