473,382 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Can't get querystring to post to second page

I've got a c# script whereas I am trying to post from a textbox on my
firstpage.aspx over to page2.aspx, but the error I get is:The name
'txtstuff' does not exist in the class or namespace 'ASP.page2_aspx'
firstpage.aspx button object subroutine:
///////////////////////
private void btnSubmit_Click(object sender, System.EventArgs e)
{
Response.Redirect("dg4.aspx?txtboarddate=" +
this.txtboarddate.Text);
}
///////////////////////
page2.aspx script:
//////////////////////////////////////////
<%@ Import Namespace="System.Data"%>

<%@ Import Namespace="System.Data.SqlClient"%>

<script Language="C#" runat="server">

private void Page_Load(object sender, System.EventArgs e)

{

txtstuff = Request.QueryString["txtstuff"];

if(txtstuff != null){

if(txtstuff =="") txtstuff = "Visitor";

}

////txtstuff = Request.QueryString["txtstuff "];

////this.txtstuff .Text = Request.QueryString["txtstuff "];

BindMe();

}

// function to bind the records retrieved

// from the database to "dgrid" grid

void BindMe() {

////

string txtstuff = Request.QueryString["txtstuff"];

// build the connection string

string strConn = "SERVER=xxx.xx.xx.xx;UID=xxx;PWD=xxxx;DATABASE=myd b;";


// connect to the database

SqlConnection objConn = new SqlConnection(strConn);
// query

string strSQL = "SELECT * FROM tblDb where MyDate = '" & txtstuff &
"'";

// create an instance of the DataReader object

SqlCommand objCommand = new SqlCommand(strSQL, objConn);

objConn.Open();

SqlDataReader objReader = objCommand.ExecuteReader();
// assign the DataReader object as the source

// for the "dgrid" grid

dgrid.DataSource = objReader;

dgrid.DataBind();

// free up memory

objReader.Close();

objConn.Close();

}

</script>
???????????????
chumley

Nov 17 '05 #1
3 1031
"Chumley Walrus" <sp*******@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...

Er, unless I'm missing something totally fundamental here, you're passing a
QueryString name of 'txtboarddate', and then trying to look for a
QueryString name of 'txtStuff'...???
Nov 17 '05 #2
No sorry, the querystring name is 'txtstuff', not txtboarddate, as
txtstuff is just a generic example

Nov 17 '05 #3
"Chumley Walrus" <sp*******@yahoo.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
No sorry, the querystring name is 'txtstuff', not txtboarddate, as
txtstuff is just a generic example


Can you please send your "EXACT" code without modification...
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: London | last post by:
Hello Can you help me. By ASP How can I get the dropdown(control'name)'s selected value? What is it's property'name?
3
by: Jon | last post by:
Hi, I have hyperlink objects in a datagrid that redirect the user back to the current page with this syntax: <a href="mypage.aspx?id=foo"> When the page reloads, code in Page_Load then takes...
2
by: Hazzard | last post by:
I am trying to figure out how to add an additional value to a querystring collection so that when I click on a datagrid cell, there will be a key to distinguish it from another column's...
2
by: Magnus Blomberg | last post by:
Hello! I'm quite new to ASP.Net and trying to send a variable from one page to another. Om my first page, Index.htm page I have a link as: <a href="Default.aspx?MyID=7">Def 7</a> On...
5
by: Davids | last post by:
when using the page to POST (from a form) I want the page's querystring to be cleared, how do I do that?
6
by: Chumley Walrus | last post by:
I've got a c# script whereas I am trying to post from a textbox on my firstpage.aspx over to page2.aspx, but the error I get is:The name 'txtstuff' does not exist in the class or namespace...
3
by: Nirmal Singh | last post by:
I am trying to learn ASP.Net 2.0. I have a page which lists Post Numbers in a gridview and returns the selected Post Number. Using this post number I want to display a second page using SQL...
0
by: mohaaron | last post by:
Hello all, I'm having a problem using the ReturnUrl parameter while using FormsAuthentication. If I already have some querystring parameters in the url like this. ...
1
by: mark4asp | last post by:
Ok so my previous message about the vanishing ReturnUrl value was also lost! - grrrr Fate - I'll get my revenge on you - if you think you can toy with me like this! I decided to change the form...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.