Wednesday, August 18, 2010

How do I display data in a textbox based on an ID passed from 1st page?

On my Home page I have a gridview that has Four columns: CustomerID, Product, Quantity, then a link (which appears on each row..called View). When a user clicks View on a particular row it will then send that particular CustomerID to the next page (CustomerProfile.aspx).





On the CustomerProfile.aspx page I have a textbox where the Customer Name should appear. How do I go about displaying the customer name in the textbox based on the CustomerID passed to the customerprofile.aspx page? Do I need to call a stored procedure? Do i need to call the Customer Table in my code?





(i'm using C#) Thanks!! Ur help is very much appreciated!How do I display data in a textbox based on an ID passed from 1st page?
In PHP it would be: $_SESSION['CustomerID']





--------





Sorry, didn't see that part the first time thru. You would need to pull from your database table. Sounds like you know what you're doing, but it would be something like this (again in PHP):





$query = ';SELECT Customer_Name FROM TableName WHERE CustomerID=CustomerID';;


$result = mysql_query($query);


$row = mysql_fetch_array($result);


$customer = $row['CustomerID'];

No comments:

Post a Comment