Link to home
Start Free TrialLog in
Avatar of dodgerfan
dodgerfanFlag for United States of America

asked on

ASP.Net passing values between forms

I'm having a problem passing a value between forms in ASP.Net (C# code behind). On my first page, I select a record from a grid and a new page opens up that displays just the selected record. This TravelForm opens correctly, and the data is divided up into different sections. I have a button after each section to edit the data. So section one has an Edit button. The onclick event uses javascript to open another form (TravelEdit) as a popup to allow editing. The id of the record is in the query string of the TravelForm page (/TravelForm.aspx?id=1001). In the databind event on the TravelEdit button, I try to call the record with that ID. The query passed to the code is:
string trData = "select * from tablename where trip_id = " + Request["id"];
That is not working. I get an incorrect syntax error near '='. When I debug, I can see that no value is being passed. I've also tried:
string trData = "select * from tablename where trip_id = '" + Request.QuesrtyString["id"] + "'";
Any idea what I'm doing wrong here?
SOLUTION
Avatar of Rajkumar Gs
Rajkumar Gs
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dodgerfan

ASKER

No the URL is visible and you can see the id. TravelForm.aspx?id=1001.
ASKER CERTIFIED SOLUTION
Avatar of gery128
gery128
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I got this working. These suggestions helped me get it going.