473,466 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Retrieve value of an asptextbox

I am using Web Developer Express 2005. I created a little form to add
some content to a database. I keep the formview default mode in the
insert mode. The values are being added to the database fine.

How do I retrieve a value of one of the textboxes and assign it to a
variable so I can pass it along to a new page after the insert event?

Thanks
Jun 27 '08 #1
4 1247
"Michael" <bg********@gmail.comwrote in message
news:aa**********************************@z72g2000 hsb.googlegroups.com...
How do I retrieve a value of one of the textboxes and assign it to a
variable so I can pass it along to a new page after the insert event?
string strMyVariable = MyTextBox.Text;
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #2
Mark,

Dont I have to use some type of findcontrol method ?

Thanks
Jun 27 '08 #3
"Michael" <bg********@gmail.comwrote in message
news:dc**********************************@8g2000hs e.googlegroups.com...
Dont I have to use some type of findcontrol method ?
Not unless the TextBox is contained within something like a GridView or a
UserControl etc...

If it's just on the page, then you can refer to it explicitly:
http://msdn.microsoft.com/en-us/libr...tbox.text.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #4
After serious thinking Michael wrote :
I am using Web Developer Express 2005. I created a little form to add
some content to a database. I keep the formview default mode in the
insert mode. The values are being added to the database fine.

How do I retrieve a value of one of the textboxes and assign it to a
variable so I can pass it along to a new page after the insert event?

Thanks
If you want to "pass variables to another page", then a regular
variable is not enough: After a redirect to that other page all your
variables are cleared.
But this is a very common situation, so there is a common solution:
store the values in Session.

example in C#:

Session["MyValue"] = "Some Value";

string s = (string)Session["MyValue"];

Note: everything is stored as "object", so you need to cast to the
proper type.
Hans Kesting
Jun 27 '08 #5

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

Similar topics

2
by: forums_mp | last post by:
I've got an STL class (see below) with two functions to store and retrieve data - msg structs. The "Store" function when called will copy the received message (depending on which message) into...
1
by: Eugfene | last post by:
I have the following function in a html file: function selectEdit(fileID, processCode, processID, fileName,fileDesc) { document.forms.recordID.value = fileID; document.forms.processor.value =...
5
by: Roy Gourgi | last post by:
Hi, I am used to working in Visual FoxPro and I would like to be able to create a database and store and retrieve information from it. What is the simplest way to do it and what should I be...
2
by: epigram | last post by:
I'm responding to a button click event on an asp.net web form. I then need to retrieve the value from a TextBox control and I want to compare it against the control's previous value to see if it...
2
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can...
4
by: kang jia | last post by:
hi i am doing mailinglist currently. the code in my first page is like this : : <html> <head> <link rel="stylesheet" type="text/css" href="gallery.css" /> <script language="JavaScript"> ...
21
by: giandeo | last post by:
Hello Experts. Is it possible to retrieve the value from a populated pull down menu from a database and then use that value to access the same database to get the related fields. Example: ...
2
by: Cramer | last post by:
Using ASP.NET 3.5... As far as I know, any time we store a value in application or session state, it is stored as a humble 'object' type rather than it's "real" type. For example, if we want...
1
by: divya | last post by:
Hello, I used the below code to move selected items between two listboxes Left and Right:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestPopup.aspx.cs" Inherits="TestPopup" %> ...
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
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,...
1
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.