Gridview is populated by assigning datatable as datasource to gridview. The gridview shows project ids as links and the control transfers to Request2Detail.aspx page. In Request2Detail.aspx, I have to show information of the project id that was clicked.
However, I have not been able to pass the clicked project id value to the Request2Detail.aspx. Lbtn_Select.Text contains the project id for each row of Gridview. I read that through PostBackUrl property, we can access all controls of the previous page using
Request object such as TextBox1.Text = Request.Form["TextBox1"].ToString();
However, projectid is a TemplateField within a gridview.
Member
9 Points
33 Posts
passing gridview cell value to another page
Dec 23, 2016 11:53 AM|Shehzad Rattani|LINK
Hello,
I have a GridView control on a Request2.aspx page. In the <Columns> section, there is a TemplateField showing project ids from the project table:
Gridview is populated by assigning datatable as datasource to gridview. The gridview shows project ids as links and the control transfers to Request2Detail.aspx page. In Request2Detail.aspx, I have to show information of the project id that was clicked. However, I have not been able to pass the clicked project id value to the Request2Detail.aspx. Lbtn_Select.Text contains the project id for each row of Gridview. I read that through PostBackUrl property, we can access all controls of the previous page using Request object such as TextBox1.Text = Request.Form["TextBox1"].ToString();
However, projectid is a TemplateField within a gridview.
Regards,
Shehzad
Star
11749 Points
2997 Posts
Re: passing gridview cell value to another page
Dec 23, 2016 02:16 PM|paindaasp|LINK
This assumes that there is no restriction in passing the projectid as a QueryString parameter. Try this:
Then in the Request2Detail page, Request.QueryString("id);
Member
9 Points
33 Posts
Re: passing gridview cell value to another page
Dec 24, 2016 05:08 AM|Shehzad Rattani|LINK
Thanks a lot paindaasp. It worked perfectly with the following code:
Regards,
Shehzad