Click here to Skip to main content
15,919,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear everyone,
My question seems to be a frequent asked question (when searching on google at least). However, after spending 5 hours trying many things i have not found the right solution yet.

My case:
I have a webform with a datagridview populating all my products. I want to be able to select one of the products and then show more details from this in another webform called productdetails. These details shoul be generated by some sql queries that uses the product No to fetch detailed records. But this is not easy!

What I have tried:

1) I have tried to pass the value from one textbox in webform1 to webform2 without succes. Webform2.textbox is inassessiable due to protection.
Posted
Updated 12-Apr-16 6:31am

1 solution

Pass it through the query string. That is probably the easiest way.
 
Share this answer
 
Comments
Kristian_dk 12-Apr-16 13:35pm    
Hello RyanDev. I'm a newbie - could you elaborate a little bit on how I do that ?
I have two sql queries. The first one on Webform1 which populates all products and the productnumber. The second sql query is on webform2 which shows all product details. This sql query is based on a WHERE product_no = @product_no
But how do i pass my productnumber from Webform1 into that WHERE statement?
Help :-)
ZurdoDev 12-Apr-16 13:42pm    
There are many ways to do it, but it will depend on how you are getting to webform2.

For example, you could do:
Response.Redirect("webform2.aspx?product_no=" + product_no);

Then in Page_Load() of webform2 you can do
String product_no = Request.QueryString["product_no"];
Kristian_dk 12-Apr-16 14:23pm    
RyanDev.. You are the MAN!! I have tried so many Things and spend now 7-8 hours solving this. You solution is absolutely awsome!! thank you!
ZurdoDev 12-Apr-16 14:30pm    
You're welcome. And this is a very simple and straightforward and common way of doing it. :) But I'm glad you now know how to do it.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900