如何将数据girdview值从一个webform发送到另一个webform [英] how to send data girdview values from one webform to another webform

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

问题描述

我想从一个页面发送网格视图数据到另一个,而不使用数据库

解决方案
的document.getElementById( currentpage_div)。innerHTML的= window.opener。的document.getElementById( clientidofGRID)的innerHTML。



//即,从window.opener.document.getElementById(clientidofGRID)我们将获得上一页网格日期并分配给新页面中的div。 。


1.通常不会指示这样做,但可以使用 Server.Transfer(从第二种形式访问第一种形式到第一种形式。 Your2ndForm.aspx),这样你可以通过第二个网页表单页面加载第一个表单中的公共数据,例如下面这样:

 私有  void  Page_Load( object  sender,System.EventArgs e)
{
Your1stWebForm1 firstWebForm;
firstWebForm =(Your1stWebForm1)Context.Handler;
firstWebForm.YourGrid ... // 访问你的网格!
// ...
}



2.更好的方法是尝试找到另一种通信方式,例如,如果您的网格中有一小组数据,则可以缓存数据,然后在第二个网格中重复使用。



您可以在下一篇文章中找到同一Web应用程序的Web表单之间的所有可能的通信方式: http://dotnetslackers.com/community/blogs/haissam/archive/2007/11/26 /ways-to-pass-data-between-webforms.aspx [ ^ ]


1)Gridview值到DataTable。



2)DataTable进入会话。



3)将会话值传递到您想要的另一个页面。



4)收到会话价值。


i want to send grid view data from one page to another without using database

解决方案

document.getElementById("currentpage_div").innerHTML = window.opener.document.getElementById("clientidofGRID").innerHTML;

// ie,from window.opener.document.getElementById("clientidofGRID") we will get the previous page grid date and assign to a div in new page..


1.Normally it is not indicated to do that, but it is possible to have access from 2nd form to the 1st one by using Server.Transfer("Your2ndForm.aspx"), so in this way you may access the public data from the 1st form in your 2nd web form page load for example like bellow:

private   void   Page_Load(object   sender,   System.EventArgs   e)
  {
    Your1stWebForm1   firstWebForm;
    firstWebForm=(Your1stWebForm1)Context.Handler;
    firstWebForm.YourGrid... //Accessing your grid!
    //...
  }


2. Better is to try to find anther way of communication, for example if you have a small set of data in your web grid you could cache the data then reuse it in the 2nd grid.

You could find all possible way of communication between web forms of the same web application in the next article: http://dotnetslackers.com/community/blogs/haissam/archive/2007/11/26/ways-to-pass-data-between-webforms.aspx[^]


1)Gridview Values into DataTable.

2)DataTable into Session.

3)Pass the Session Value into another Page which you want.

4)Receive the Session Value .


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

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