ASP.Net passing values between forms

Posted on 2011-10-20
Last Modified: 2012-08-14
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?
Question by:dodgerfan
    LVL 23

    Assisted Solution

    by:Rajkumar Gs
    In the URL, is the querystring 'id' is blank ?
    If URL is not visible, right-click the page and check there.

    Author Comment

    No the URL is visible and you can see the id. TravelForm.aspx?id=1001.
    LVL 9

    Accepted Solution

    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?

    Author Closing Comment

    I got this working. These suggestions helped me get it going.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now