473,396 Members | 1,816 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,396 software developers and data experts.

Bind a querystring being passed over

Please help. I'm a newbie. Using VS2005.

I have a simple aspx page. I want the querystring being passed in to bind
to a textbox in a control. How do you do this?

Basically, www.website.com?string=100

The site autoloads into Formview1 / InsertItem Template. TextBox1 shows up
as blank waiting for me to put in the value "100", but I want Textbox1 to
autograb that value and put it in. Is this possible?

This is what I tried and I really thought this would work:
In page load:
Dim Answer as string
Answer = Request.Querystring("string")
Formview1.InsertItemTemplate.Textbox1 = Answer
Thanks!

Phil
Aug 28 '06 #1
2 1591
"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Please help. I'm a newbie. Using VS2005.

I have a simple aspx page. I want the querystring being passed in to bind
to a textbox in a control. How do you do this?

Basically, www.website.com?string=100

The site autoloads into Formview1 / InsertItem Template. TextBox1 shows
up as blank waiting for me to put in the value "100", but I want Textbox1
to autograb that value and put it in. Is this possible?

This is what I tried and I really thought this would work:
In page load:
Dim Answer as string
Answer = Request.Querystring("string")
Answer = Request.Querystring("string").ToString()
Formview1.InsertItemTemplate.Textbox1 = Answer
Formview1.InsertItemTemplate.Textbox1.Text = Answer

Several points:

1) Try to get out of the habit of accepting the default control names e.g.
Formview1, Textbox1 etc and try to use more descriptive names instead.

2) The code above does not have any error handling e.g. what happens if the
Querystring doesn't contain a "string" name/value pair?

3) Try to avoid using reserved words (e.g. "string") for variables.
Aug 28 '06 #2
Thanks Mark!

Someone at another site told me to just put request.querystring("answer") in
the custom binding of that textbox and this worked perfectly.

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:eu**************@TK2MSFTNGP06.phx.gbl...
"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Please help. I'm a newbie. Using VS2005.

I have a simple aspx page. I want the querystring being passed in to
bind to a textbox in a control. How do you do this?

Basically, www.website.com?string=100

The site autoloads into Formview1 / InsertItem Template. TextBox1 shows
up as blank waiting for me to put in the value "100", but I want Textbox1
to autograb that value and put it in. Is this possible?

This is what I tried and I really thought this would work:
In page load:
Dim Answer as string
Answer = Request.Querystring("string")
Answer = Request.Querystring("string").ToString()
>Formview1.InsertItemTemplate.Textbox1 = Answer
Formview1.InsertItemTemplate.Textbox1.Text = Answer

Several points:

1) Try to get out of the habit of accepting the default control names e.g.
Formview1, Textbox1 etc and try to use more descriptive names instead.

2) The code above does not have any error handling e.g. what happens if
the Querystring doesn't contain a "string" name/value pair?

3) Try to avoid using reserved words (e.g. "string") for variables.

Aug 28 '06 #3

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

Similar topics

3
by: Arpan | last post by:
A link has the following URL: <a href="Page1.asp?cname=<%= Request.QueryString("cname") %>&cadd1=<%= Request.QueryString("cadd1") %>&cadd2=<%= Request.QueryString("cadd2") %>&cplace=<%=...
4
by: Deepster | last post by:
Hi Guys Here is what I am doing ... Have a page default.asp which looks at the url and checks for querystring's. if there are none passed goes to a function. if there are particular querystrings...
1
by: lion | last post by:
my Problem: a query string passed into a html page doesn't display correctly on a mac I am just using html and javascript (no ASP, PHP or server side scripting) This is the query string:...
5
by: Arpan | last post by:
An ASP application retrieves records from a SQL Server database. In the first page of the application, the user has to enter a password & the columns retrieved from the DB table depends upon the...
3
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so...
4
by: EDOnLine | last post by:
We have a page which, after inserting a record ID to our database via stored proceedure, redirects the user to a URL on a thrid party site which as passed to that page via QueryString. In other...
2
by: Carlos | last post by:
Hi all, I would like to have a page that checks for an optional parameter being passed. I use the request.querystring("myvar") when the parameter is being passed, but when the parameter is...
4
by: =?Utf-8?B?RVcgTmV3Ymll?= | last post by:
My apologies in advance if there is a better forum for this question. Given the following snippet: <script type="text/c#" runat="server"> protected void Page_Load(Object Sender, EventArgs e)...
2
by: Arch Stanton | last post by:
I have an aspx page with a text box. My user enters text to search for and presses a button; the text is passed via a QueryString to another aspx page and used in a SQL search. The wildcard...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.