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?
dodgerfanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rajkumar GsSoftware EngineerCommented:
In the URL, is the querystring 'id' is blank ?
If URL is not visible, right-click the page and check there.
0
dodgerfanAuthor Commented:
No the URL is visible and you can see the id. TravelForm.aspx?id=1001.
0
gery128Commented:
are you writing this line in button click event?

string trData = "select * from tablename where trip_id = " + Request["id"];

than it should work properly. How do you divide the sections ? I mean what you have used for it? Divs ? or Tables?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dodgerfanAuthor Commented:
I got this working. These suggestions helped me get it going.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.