Transfer data from page to another page

I have a .aspx page (we'll call it Form1) with a
datagrid on it. The datagrid is populated from a dataset
that I manually entered data into (the data isn't in a
database). The datagrid on Form1 has a checkbox.

when i click checkbox the row is selected so the selected row should be displayed in the form2 a grid.when i check the grid it should go back to the grid in the parent page


I have another .aspx page (Form2) with an
unpopulated datagrid on it. I want to populate it with
all the columns from the select click of the checkbox row . I just don't know how to pass the row from
aspx page  to another page 


can anyone provide me with the code ??

5/10/2008 3:58:26 PM 91979 articles. 3 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 18

Brief code snippet that should do the trick for you, this is only a template for you to work on:

DataTable dt = new DataTable; //create datatable to store your row
DataRow dr = dt.NewRow();   
dr["ColumnName"] = "some data"; //set data to the row
Session["DT"] = dt;

//Retrieve data in another page through Session

DataTable dt = (DataTable)Session["DT"];

 Let me know if you need to know more. 




5/10/2008 5:59:43 PM

 different ways to transfer data frm one page to another page.

1) response.redirect

2) server.transfer

3) server.execute

4) cookies

5) session

 check these links


5/10/2008 7:14:51 PM


Hi Abhishek , Thanks.i would like to know more .can i get more my grid,i have a checkbox when i click the checkbox the row is selected i need to transfer the selected row to another page into a my second page i am retrieving all values into a grid where checkbox is checked and unchecked.i need the code.pls pls hel pme.




5/11/2008 4:58:36 AM

use Item command event to grid to implement above functionality 

If this post helps you, please mark it as Answer.

Muhammad Rizwan Javed
Sr .Net Developer
Aim 168, Dubai, UAE.
5/11/2008 6:41:39 AM


I have refined this a lot more for you but please try to understand the logic before implementation. Use this as your template & you should be good.

DataTable dt = new DataTable; //create datatable to store your row

foreach (DataGridItem item in dgr.Items)
                CheckBox chk = (CheckBox)item.FindControl("chk");
                if (chk.Checked == true)
                  TextBox txt = (TextBox)item.FindControl("txt");
                   DataRow dr = dt.NewRow();   
                   dr["ColumnName"] = txt.Text; //set data to the row

Session["DT"] = dt; //store datatable in session

//Retrieve data in another page through Session

DataTable dt = (DataTable)Session["DT"];
dgr1.DataSource = dt;

Please mark post as answer if you think it answered your query. 



5/11/2008 7:03:15 AM


Pass value between child page and parent page you can use JavaScript to achieve it.

There are two pages exist. One is main page another is popup page, which must be popuped by main page.

Main page:

    <form id="form1" runat="server">
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" />

        private void Page_Load(object sender, EventArgs e)
            //create our update function
            StringBuilder str = new StringBuilder();
            str.Append("<script language=javascript>");
            str.Append("function update(e){");


            // register the javascript into the Page
            if (!ClientScript.IsClientScriptBlockRegistered(this.GetType(), "update"))
                Page.RegisterClientScriptBlock("update", str.ToString());
            Button1.Attributes.Add("onclick", "'Popup.aspx',null,'left=400, top=100, height=250, width= 250, status=no, resizable= no, scrollbars= no, toolbar= no,location= no, menubar= no');");



    <form id="form1" runat="server">
        <input id="Text1" type="text" /><input id="Text2" type="text" />
        <asp:Button ID="Button1" runat="server" Text="Button"  />
    private void Page_Load(object sender, System.EventArgs e)

        string str = @"<script language=javascript>
        function Tovalue()
            var text1=document.getElementById('Text1').value;
            var text2=document.getElementById('Text2').value;
            var ar= new Array(text1,text2);

            if (!ClientScript.IsClientScriptBlockRegistered(this.GetType(), "Tovalue"))
                 ClientScript.RegisterClientScriptBlock(this.GetType(), "Tovalue", str.ToString());

            Button1.Attributes.Add("onclick", "Tovalue();");

In the codes above, you can use Array in JavaScript to achieve multiple values being transfered.

The above code can achieve comunicating between child page and parent page. You can modify a part of codes to achieve your purpose.

In your case, you can fire to transfer the value to another page via JavaScript when checkbox is checked.

Hope it helps.


Vince Xu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
5/13/2008 8:59:05 AM

Similar Artilces:

how to transfer data one page to another page
hi. anyone help me, how to transfer data my page to another url page  using post method in with c# check out the link > Transferring page values to another pageyou will find various techniques to transfer data from one page to another page using Cookies, QueryString, Session, Application etc., using Server.Transfer / Response.Redirect...hope it helps./. Thanx, [KaushaL] || BloG || Profile || Microsoft MVP"I would love to change the world, but they won’t give me the source code"Don't forget to click "Mark as Answer" on the post that helped ...

TRansfering data from one page to another page?
 in my web application, when user login i get a value from called empid from database for that particular user and i wan to use that empid for entire apllication till the user logged in....How can i use same empid in entire pages????i hav to keep using responce redirect to transfer that empid from one page to another page?????  The most common way to do this is to use a Session variable.  But there are loads of ways of "maintaining state" across web pages: Regards Mike [MVP - ASP/ASP.NET]My site Indeed, you could use a ...

get data from Gridview in one page to textboxes in another page.
 Hi here iam having Gridview in one page .it is binded to some data.I used querystring to transfer data from Gridview to Textboxes in next my question is i want to edit the textboxes and make changes reflect in database.i edited the textboxes by just deleting the value in Textbox and entering new value.but The changes i made to textboxes are not reflected at runtime.When i debug the codeThe values in TextBox are previous values. The changed values are not reflected.because of that iam not able to update the database.Is there property for textbox to take place the changes i made...

How to transfer a page to another page?
I set up a page permission by registered user only and link to another page after a user login. But after a user login, the user still comes to the page and the page does not transfer to another page. How do I do it ? Thanks! Netadventure NetAdventure...

Paging Paging Paging
I am trying to do paging with my search results and it isnt working very well. Here is what I've tried and I feel I've tried everything, lol, please help me out. Sub DataGrid1_SortCommand(Sender as object, e as DataGridSortCOmmandEventArgs) DataGrid1.DataBind() End Sub Sub Datagrid1_PageIndexChanged(Sender as object, e as DataGridPageChangedEventArgs) Dim ds as dataSet DataGrid1.CurrentPageIndex = e.NewPageIndex if Session("Search") is nothing then 'Session probably has expired, get the datasource from database Datagrid1.DataSource = ...

what is the best approach, when it comes to transfer data from one page to another page?
what is the best approach, when it comes to transfer data from one page to another page? i have two thing in my mind 1) using Context.Handler 2) Cross Page Postbacks dunno which to use and i'm really want to see what other thinks.   thanks.Its all about coding! CrossPage Postback is easy to use but has somewhat restriction, sometimes. When you want to refer to a public member of the previous page, you need to add  <%@ PreviousPageType VirtualPath="~/FirstPage.aspx" %>  in the page which may leads to inflexibility. Context....

Getting things back in Start Page and things out of Start Page
I know I posted over a year ago about this same question, I can not find my original post though. I know I posted it and I did find the solution and posted the sollution but I can not find it anywhere here again. They really need a better search engine on these forums. Is there any tools out there to help manage the start page? For example. I have projects that are on a web server I access them on the remote server. Well the start page never ever shows any updates for it the date posted as last access is the day I created it, However this is one of my more used projects. This one is so b...

show the data of current page compleatly and ,then after few second I want to Redirect the page to another page
I want to load a page first after that I have to tranfer control to another page only after wating/passing few seconds. So I tried the following and failed Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete showDataOfCurrentPage() Dim sleepT As Int64 = 100000 Threading.Thread.Sleep(sleepT) Response.Redirect("URL")) End Sub I failed because I wrote the sleep code in Page_Load So I tried it ny writing it on Page_LoadComplete That too failed . So in short i want to show the data of current page com...

Transfering data from one page to other page
Hi! I have a my master page which has one datagrid which display all data from one table. It had couple of field on my grid like ID-select button, partno, partdesc, date etc.. What i am trying to do if i click on ID (select button field ) then i would like to transfer data to the other page where they can able to edit the data. Second form is like data entry form has lots for field. How can i transfer data or Id field value to i can fill up my other page. I have pnlform (carried field) on same page and it work as soon as i click on Id it fill up the all field on same page and t...

how to call the data from one page the another page
i would like to call some particular record from one column of gridview from one page1 to another new page,for example:price column in page one,i would like to display the price column value in page2.any idea? Hello,   You can pass values from a gridview to another page using a hyperlink field for that particular column. Within the hyperlink control there is a value you can set in DataNavigateUrlFormatString.  I can remember the make up of the what u enter but search for that and there be loads of pages explaining.   Hope this helps. Kevin   i don really u...

data pass from one page to another page
 Hi,If i have a 3/4 pages and i want to pass the values of the forms and at last i save the data of the forms. Let , my each page contains about 10 values, and user can go previous page to edit. Finally, all the data of the forms are saved. I know Session , but which is the best practice for this?Thanks.. naqibdotNet Coder You have the answer: Session. You can do this: Session["data1"] = data1value; Session["data2"] = data2value; And on the page where it is needed, go: decimal price = (decimal)Session["price"]; The casting is necessary. Store each f...

Transfer Value from one page to another page...
  Now I have a value in my code, called "MID" (Integer) I create a Frame in my page and I want this frame link to another page using MID as parameter. My code is : <iframe src=sample.aspx?ModelID=<%# MID %>></iframe> But I always get an error : BC30516: Overload resolution failed because no accessible 'Mid' accepts this number of arguments   Someone can help me to solve this ? Thx a lot~ :) Hi there, You are getting this error message as Mid is a function in Rename your variable and it should work... Hope this helpsSunny NAGIProper Prep...

Transfer Child Page to Another Page from MasterPage
Hi There, What I Want is to Check in a AppSettings value in Web.Config, if user exists, so i Need to transfer Child Pages to an error page if users does not exists. My AppSettings in Config file are:  <appSettings> <add key="Users" value="john;bill" /> </appSettings>  In my MasterPage i have:Dim str,UserName as String Dim Users() As String Dim IsUserInRole as Bolean 'Get User fom User Domain UserName=Page.User.Identity.Name.Substring(Page.User.Identity.Name.IndexOf("\") + 1) IsUserInRole =False User...

How to include another .NET page in your current page ?
Hello, Very simple question how do you include another .NET page in another ? Like say a include=test.aspx or something. I don't think it is possible and if it is, please someone show me some example code. What you can do is create user controls (*.ascx) and dynamically include them. On your page you can set a PlaceHolder control and in your code behind you could attach a user control to it PlaceHolderControlOnPage.Controls.Add(LoadControl("test.ascx")) Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answ...

Web resources about - Transfer data from page to another page -

Talk:Asynchronous Transfer Mode - Wikipedia, the free encyclopedia
This article is within the scope of WikiProject Computing , a collaborative effort to improve the coverage of computers , computing , and information ...

All I Want for Christmas: A File-Transfer Wish List
Here's a holiday wish list for what IT professionals are longing for when it comes to secure, timely file transfers to colleagues or customers. ...

Cristiano Ronaldo Linked To Manchester City Transfer Again, City Players Confident Of Move
Cristiano Ronaldo has once again been linked to a transfer away from Real Madrid, and this time it has been alleged that Manchester City are ...

Transfer Your Notes from Evernote to Apple Notes with This Script
Ready to leave Evernote and move your notes to iCloud? This free Applescript is the quick and easy way to transfer your notes to Apple Notes. ...

Surry County real property transfers
Surry County real property transfers Mount Airy News Byron and Robin Hooper and Michael and Rita Wiles to Jean N. Guyer. Tract in Elkin. $85. ...

Groundbreaking light-based photonic processor could lead to ultra-fast data transfers
University researchers are claiming a bandwidth breakthrough with the first light-based microprocessor that communicates with conventional electronic ...

Will Grier Will Transfer From Florida
Suspended Florida Gators quarterback Will Grier will be transferring. QB Will Grier is transferring from #UF source tells @FoxSports . The former ...

4 Balance Transfer Credit Cards to Consider for 2016
Want to pay off your debt once and for all? Sign up for one of these cards.

Data transfer reaches new heights at supercomputing conference
Transferring data files may seem a routine task to some, but to researchers, it's a task that becomes arduous when large amounts of computational ...

Resources last updated: 12/25/2015 3:27:01 AM