User347430248 posted
Hi Lordakku,
there are many ways to transfer the values from gird view to another page.
one way is to use
Page.PreviousPage property with find control method.
protected void Page_Load(object sender, EventArgs e)
{
if (this.Page.PreviousPage != null)
{
GridView GridView1 = (GridView)this.Page.PreviousPage.FindControl("GridView1");
}
}
Reference:
Pass ASP.Net GridView from one page to another page
you can do the same using Hyperlink.
protected void Page_Load(object sender, EventArgs e)
{
if (this.Page.PreviousPage != null)
{
int rowIndex = int.Parse(Request.QueryString["RowIndex"]);
GridView GridView1 = (GridView)this.Page.PreviousPage.FindControl("GridView1");
GridViewRow row = GridView1.Rows[rowIndex];
lblId.Text = row.Cells[0].Text;
lblName.Text = (row.FindControl("lblName") as Label).Text;
lblCountry.Text = row.Cells[2].Text;
}
}
Reference:
ASP.Net Pass or Send GridView Row Values to other Page with HyperLink
you can fetch data using query string:
<asp:HyperLinkField DataNavigateUrlFields="CustomerID, CompanyName, ContactName, Address, City" DataNavigateUrlFormatString="CustomerDetails.aspx?CID={0}&CName={1}&ContactName={2}&Addr={3}&City={4}" Text="Pass Multiple Values" />
protected void Page_Load(object sender, EventArgs e)
{
string cid = Request.QueryString["CID"];
string cname = Request.QueryString["CName"];
string contactName = Request.QueryString["ContactName"];
string address = Request.QueryString["Addr"];
string city = Request.QueryString["City"];
}
Pass Multiple Values from a GridView to Another Page using ASP.NET
you can find another example in link below.
Pass ASP.Net GridView from one page to another page
Regards
Deepak