如何从一个gridview到另一个gridview访问值 [英] how to access value from one gridview to another gridview

查看:78
本文介绍了如何从一个gridview到另一个gridview访问值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我有一个疑问,

如何从一个网格视图列中的值访问另一网格视图事件中的值(行命令)

我需要从grid_view1获取Menu_id
并传递到grid_view2.


请问

通过mohan.

dear friend,

I have one Doubt,

how to access value from one grid view Column to another grid view event(row Command)

i need get Menu_id from grid_view1
and pass to grid_view2.


Plz?

By mohan.

推荐答案

这可能会有所帮助,在一个事件上,您可以像这样调用另一个事件:

This might help, on one event you can call another event like this :

<pre lang="cs">public void Control1_KeyDown ( object sender, System.Windows.Forms.KeyEventArgs e )
{
    if ( e./* something */ )
    {
        Button1Clicked();
    }
}

public void Button1_Click ( object sender, EventArgs e )
{
    Button1Clicked();
}

private void Button1Clicked ( )
{
    // do whatever you wanted to do in the Button_Click event
}



首先生成gridviewrow_command事件
然后编写以下代码
if(e.commandname =="edt")
{
Label1.Text = e.CommandArgument.ToString();
session ["myid"] = label1.text;

}
通过以上代码,可以创建会话变量myid,您可以在应用程序中的任何位置使用它.
希望它有用.
如果对您有用,请给我回复.
来自vikranth redddy
first generate the gridviewrow_command event
then write the following code
if(e.commandname=="edt")
{
Label1.Text = e.CommandArgument.ToString();
session["myid"]=label1.text;

}
by the above code a session variable myid is created you can use that any where in your application.
hope it is useful.
if it is useful to you please give reply to me.
from vikranth redddy


这篇关于如何从一个gridview到另一个gridview访问值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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