How to post data from gridview on one page to detailview on another page when select is used

I need to get data from gridview on one page to detailview on other page when I use select statement.I am able to do this on same page by using following code but not able to do this on different page

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        DetailsView1.PageIndex = GridView1.SelectedIndex;
    }

 

Is it possible that when I use select in gridview on a particular page then only that row data appear on detail view of another page. please let me know asap. 


Find the Best Webhosts on Internet on http://www.besthostonline.com
0
safibaig
12/15/2007 6:46:07 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

4 Replies
868 Views

Similar Articles

[PageSpeed] 26

You could pass the ID of the record as a querystring to the other page e.g.

 
Response.Redirect("otherpage.aspx?id=" &  GridView1.SelectedIndex)
 
Then, you can read the id in your other page by using:
Request.Querystring("id")
 

Website Design Darlington - http://mdssolutions.co.uk
http://lessthandot.com - Experts, Information, Ideas & Knowledge
http://aspnetlibrary.com - An online resource for professional ASP.NET developers


Please remember to click "Mark as Answer" on this post if it helped you

0
ca8msm
12/17/2007 8:39:33 AM

You can also use Session Variable like below

 I assumed that you have used the SELECT commandField in your GridView.
 

    protected void Button1_Click(object sender, EventArgs e)
    {
      
        for (int i = 0; i < GrdiView1.Rows.Count; i++)
        {
            if (GrdiView1.SelectedIndex == i)
            {
                String id =GrdiView1.Rows[i].Cells[1].Text; //Gets the id value in the grid based on the selected index;
                Session["Value"] = id;
                Response.Redirect("SecondPage.aspx");

            }
        }
       
    }

SecondPage.aspx

On page load you can get the value of your stored in the session variable

protected void Page_Load(object sender, EventArgs e)
{
 
    string getid = Session["Value"].ToString();

   //Now you can bind your DetailsView based on that id

}


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
12/17/2007 8:54:42 AM

Thanks for replying.

How  can  I add a new row in my gridview I want automatically  
a detailview of that row in a new page is created.


Find the Best Webhosts on Internet on http://www.besthostonline.com
0
safibaig
12/17/2007 12:13:49 PM

You're Welcome! Anyways....you can refer to this article regarding that matter

http://www.koffeekoder.com/ArticleDetails.aspx?id=98 


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
12/18/2007 1:13:02 AM
Reply:

Similar Artilces:

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

HOW TO FIND OUT WHICH DROPDOWN CONTROL WAS SELECTED LAST OUT OF SEVERAL ON THE PAGE AND THEN USE THAT CONTROL FOR PAGING IN THE DATA GRID
I have the following on my page: 1.DataGrid2. 3 Dropdown controls: 1 for filtering by date, 1 for filtering by category, and 1 for filtering alphabetically. The data grid shows the information when one of the items in one of the dropdown boxes selected. Here is the problem: I have included a code to find out which dropdown was selected based on it's id, or name in the paging event handler. However, since I have included code to handle paging for all 3 dropdowns it doesnt work correctly. when I included code for 2 drop downs it worked properly. What I meant&...

inserting record present in one gridview in one page into gridview in other page
hi,i have two .aspx pages.one page(watch.aspx) have gridview with fields  given below.the fourth column is a hyperlink column                                                        watch.aspx                      ...

Gridview paging enabled. Has checkbox to select the row . If user select the checkbox on one page and move to 2nd page to select the rows there also to export the selected rows to excel. But doing so
HiI am using Gridview and that has paging enabled. Using checkbox to select the particular row of the gridview to export the selected rows to the excel . Everything is working fine except for one case.Let user selected the "check" box for, five rows which user would like to export to excel (two of rows on page 1 of results and 3 of them on page 2 of results), however it only exports the 3 row details from page 2, because it seems to de-select the 2 rows from page 1 when I move to page 2 and vice versa. The code i am using is as :protected void BtnExcel_Click(object sender, EventArg...

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 page.now 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...

Help with copying data from one gridview to another gridview on another page
Hello,I have a page, frmJobListings.aspx, with a data grid that is populated with data from a table called, tblJobPostings.  I would like to copy all rows of data from three of the columns, JobRefNum, JobRequirements, and JobTitle on the page and populate a datagrid on another page called, frmJobDetails when I click on a button called, btnJobDetailBuilder. Problem: When I click on the btnJobDetailBuilder the page frmJobDetails opens but does not display the datagrid, errors, or any information.  I know that I need to do a data bind, but not sure if or how to databind to the 'Re...

One Page Gridview select --> New Page Data manipulation
Hey Im sorry to start a new post about this topic, but Im a bit puzzled as to how to search for this.I have a GridView with a list of Jobs that have been generated when a User is selected, this process is done on the same page and I simply used a "SelectedValue" and Control method of the DataSource to select the info.What I dont know, is how to do the same thing over two pages.  Basically what I want to do is select a hyperlink in the gridview on one page and be directed to the other page with a DataView of that information.  I would guess it would involve passing...

GridView's data sent to another GridView control on another page
I'm trying to get send a Gridview1 control's DATA on page1.aspx to Griedview2 on page1.aspx. I tried adding to a session varible like so:page1.aspxSession["gridsData"] = GridView1;page2.aspxif (Session["gridsData"] != null){    GridView2 = ( GridView )Session["gridsData"];}When page2.aspx loads, GridView2 does not display data. There is data there, because it is NOT null in the conditional statement. Is this the best solution??Thank you,Edski Use the data itself, not the Gridview, also, I would use the cache object instead of sessionDav...

Postback of one frame in response to click of a image button in another frame in the same page(Note:-Both frames there are 2 different aspx page but in a same page page using 2 frames)
Hi all, I am having a C# coded page with 2 different frames in it.This 2 frames contain each an aspx file.So the functionality am trying is I have image buttons in one frame .So when i click that image button the other frame i have should load with a specified image in it. I tried redirecting it but that happens only in the first frame where the image buttons are.Resulted in showing the 2 frames in the first frame. I am stuck in this for almost a day.Please can anyone help regarding this?. Regards, Joseph look into the Target attribute of the anchor: for example: <a h...

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...

How do I restore a pages data when it is posted from another page.
Hi; For the life of me I can't figure this out and it should not be so hard to understand ! I have two pages in my application. On page 1 I have a gridview which display bound objectdata source data. When someone decides to edit a row in the gridview they are taken to another page via a link with a datasource key. What I would like to know is if I place a button on page2 that points to Page1 how and in which event do I save the loaded gridview ? I tried saving just the Objectdatasource filter in the page unloading and then restoring it to the ODS and rebinding during the postback....

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: http://support.microsoft.com/kb/307598 Regards Mike [MVP - ASP/ASP.NET]My site Indeed, you could use a ...

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...

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 asp.net 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 ...

Web resources about - How to post data from gridview on one page to detailview on another page when select is used - asp.net.presentation-controls

Multi-pane Layouts - Android Developers
On smaller devices your content is typically divided into a master grid or list view and a detailview. Touching an item in the master view opens ...

Russia Medvedev Zuckerberg - Buy Photos - AP Images - DetailView
AP Images : DetailView : Russia Medvedev Zuckerberg

Patent US821393 - Flying-machine. - Google Patents
Search Images Maps Play YouTube News Gmail Drive More Calendar Translate Mobile Books Offers Wallet Shopping Blogger Finance Photos Videos Even ...

Why Mozilla Matters - Hacker News
I have a hard time believing Brendan's pledge to diversity given Mozilla's non-support for Gecko embedding. There's a number of Gecko-based browsers, ...

Projects- Robotics Innovation Center - DFKI GmbH
DFKI GmbH Robotics Innovation Center (RIC) Intern - DE - EN Startpage Menu About Us DFKI RIC Robotics Group Staff Listview Detailview Thumbnailview ...

Mobile Development Samples
Following Windows Mobile Development Samples demonstrate the usage of Resco .NET CF controls in various situations.

Detailview : - http://www.steinberg.net/
Steinberg is very excited to present Cubasis — a streamlined, multitouch sequencer for the iPad. Specially designed for quick and easy operation, ...

ESL TV: Beta Status
Skip to the navigation . Skip to the content . Switch to old page Games Events Channels Schedule Videos Global (All videos) Brazil (Brazil and ...

TV on the Internet - Buy Photos - AP Images - DetailView
AP Images : DetailView : TV on the Internet

Sochi Olympics Alpine Skiing Women - Buy Photos - AP Images - DetailView
AP Images : DetailView : Sochi Olympics Alpine Skiing Women

Resources last updated: 12/4/2015 4:54:23 PM