Solved

passing dataset from one page to another

Posted on 2014-04-09
7
370 Views
Last Modified: 2014-04-23
hi ,
     My task is on clicking a button all the values in the from and grid should pass to another Page. for example if click submit button in page A , all details(form and grid) form page A  should transfer to page B. here in page be i should assign these values.


My problem is in Page B grid is initialized only on row on page load. how to add rows dinamicatlly and assign the values.


Thanks in advance
0
Comment
Question by:codeoxygen
  • 4
  • 2
7 Comments
 
LVL 22

Expert Comment

by:Mrunal
ID: 39988535
Better way ideally you have to keep this data in cache/session.
0
 

Author Comment

by:codeoxygen
ID: 39988671
my problem is not passing data ... but how to assign the values to grid manually
0
 
LVL 12

Expert Comment

by:Jitendra Patil
ID: 39991124
can you post your .aspx and .cs code here, so that we can help you in better way?

just making assumtion, if you are passing dataset from one page to another using session, you just need to create an object of dataset or datatable, cast the data from session as below.
DataSet Dt= (DataSet)session["sessiondata"];
and bind the gridview with dataset object as
gridview.datasource=dt;
gridview.databind();

hope this helps.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:codeoxygen
ID: 39993390
my problem is , i have grid view , it has add new row button.  If i want bind data from a data-set. what is the method. the scenario is, already saved grid-view data should be retrieve and even it should be editable
0
 

Author Comment

by:codeoxygen
ID: 39993401
private void FirstGridViewRow()
        {
            DataTable dt = new DataTable();
            DataRow dr = null;
            dt.Columns.Add("RowNumber", typeof(int));
            dt.Columns["RowNumber"].AutoIncrement = true;
            dt.Columns["RowNumber"].AutoIncrementSeed = 1;
            dt.Columns["RowNumber"].AutoIncrementStep = 1;
           
            dt.Columns.Add(new DataColumn("Col2", typeof(string)));
            dt.Columns.Add(new DataColumn("Col3", typeof(string)));
            dt.Columns.Add(new DataColumn("Col4", typeof(string)));
            dt.Columns.Add(new DataColumn("Col5", typeof(string)));
            dt.Columns.Add(new DataColumn("Col6", typeof(string)));
            dt.Columns.Add(new DataColumn("Col7", typeof(string)));
            dt.Columns.Add(new DataColumn("Col8", typeof(string)));
         

            dr = dt.NewRow();
            //dr["RowNumber"] = 1;
            //dr["Col1"] = dr["RowNumber"].ToString();
            dr["Col2"] = string.Empty;
            dr["Col3"] = string.Empty;
            dr["Col4"] = string.Empty;
            dr["Col5"] = string.Empty;
            dr["Col6"] = string.Empty;
            dr["Col7"] = string.Empty;
            dr["Col8"] = string.Empty;
         

            dt.Rows.Add(dr);
            Session["CurrentTable"] = dt;
            dgdItem.DataSource = dt;
            dgdItem.DataBind();
        }


this is the grid which loads at the time of pageload. if button is clicked new row will be added. If want to add data set at the time of page load what is the prodecure
0
 
LVL 12

Accepted Solution

by:
Jitendra Patil earned 500 total points
ID: 39993712
0
 

Author Comment

by:codeoxygen
ID: 40001624
guru , thanks for ur answer.

but my problem is how to data to grid which exactly like
http://www.aspsnippets.com/Articles/Adding-Dynamic-Rows-in-ASP.Net-GridView-Control-with-TextBoxes.aspx

and after binding . the grid should be editable this my requirement
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now