Click here to Skip to main content
13,046,773 members (39,944 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
How we can pass value between asp pages from data grid view in page 1 to data grid view in other page 2 as query id .
Posted 30-Sep-11 16:25pm
amer-z388
Updated 30-Sep-11 18:02pm
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

p:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:GridView ID="GridView1" runat="server" BackColor="White"
                        BorderColor="#DEDFDE" BorderStyle="None"
    BorderWidth="1px" CellPadding="4"
                        ForeColor="Black" GridLines="Vertical" onrowcommand="GridView1_RowCommand"
                        Width="595px" AllowPaging="True"
                        onpageindexchanging="GridView1_PageIndexChanging"
    PageSize="6">
                        <PagerSettings FirstPageText="First" LastPageText="Last"
                            Mode="NextPreviousFirstLast" NextPageText="Next" PreviousPageText="Prev" />
                        <RowStyle BackColor="#F7F7DE" />
                        <Columns>
                            <asp:ButtonField ButtonType="Button" CommandName="Edit" HeaderText="Edit"
                                ShowHeader="True" Text="Edit" />
                        </Columns>
                        <FooterStyle BackColor="#CCCC99" />
                        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
 

 

 
page.cs code
 

 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Edit")
        {
            int x = Convert.ToInt32(e.CommandArgument.ToString());
            Class1.index = x;
            Session["index"] = x;
            Response.Redirect("Update.aspx?ID=" +x);
        }
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        GridView1.DataBind();
 
    }
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 1 Oct 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100