[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASP.Net passing values between forms

Posted on 2011-10-20
4
Medium Priority
?
184 Views
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?
0
Comment
Question by:dodgerfan
  • 2
4 Comments
 
LVL 23

Assisted Solution

by:Rajkumar Gs
Rajkumar Gs earned 1000 total points
ID: 37001422
In the URL, is the querystring 'id' is blank ?
If URL is not visible, right-click the page and check there.
0
 

Author Comment

by:dodgerfan
ID: 37001495
No the URL is visible and you can see the id. TravelForm.aspx?id=1001.
0
 
LVL 9

Accepted Solution

by:
gery128 earned 1000 total points
ID: 37005485
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
 

Author Closing Comment

by:dodgerfan
ID: 37024930
I got this working. These suggestions helped me get it going.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Loops Section Overview
Suggested Courses

872 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