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

2.0: setting TextBox.Text

Hello,
Could you help me plase? I need to set Text property of TextBox when
second page is displayed and active. On first page I have:
Birth date: <asp:TextBox ID="BirthDate" runat="server"
ValidationGroup="BirthDate" />
...
Session["BirthDate"] = BirthDate;
On second page I have:
<asp:Calendar ID="Calendar" runat="server"
OnSelectionChanged="Calendar_SelectionChanged" />
...
protected void Calendar_SelectionChanged(object sender,
EventArgs e)
{
if (Session["BirthDate"] != null)
((TextBox) Session["BirthDate"]).Text =
Calendar.SelectedDate.ToString().Substring(0, 10);
}
But it doesn't work - no visible result.
Could you tell me plase what's wrong? Thank you very much!
/RAM/
May 13 '06 #1
2 1305
What's supposed to be the result?

--
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
"R.A.M." <r_********@poczta.onet.pl> wrote in message
news:ud********************************@4ax.com...
Hello,
Could you help me plase? I need to set Text property of TextBox when
second page is displayed and active. On first page I have:
Birth date: <asp:TextBox ID="BirthDate" runat="server"
ValidationGroup="BirthDate" />
...
Session["BirthDate"] = BirthDate;
On second page I have:
<asp:Calendar ID="Calendar" runat="server"
OnSelectionChanged="Calendar_SelectionChanged" />
...
protected void Calendar_SelectionChanged(object sender,
EventArgs e)
{
if (Session["BirthDate"] != null)
((TextBox) Session["BirthDate"]).Text =
Calendar.SelectedDate.ToString().Substring(0, 10);
}
But it doesn't work - no visible result.
Could you tell me plase what's wrong? Thank you very much!
/RAM/

May 13 '06 #2
Of course there is no visible result. You have kept a reference to a
TextBox object that is no longer used.

The controls of a page is created when the page is requested. Then the
page is rendered as HTML, and the controls used to do it are disposed.
If the page is requested again, new controls are created, used and disposed.

If you keep a reference to one of those controls, you will just be
holding on to an object that will never again be used to create a page.

Are you trying to change the value of an input field that is displayed
in a web page? Then you have to do it using Javascript. Pages are
requested from the server, and once they are sent to the browser there
is no connection between the browser and the server. You can't send
something from the server to a page that has already been sent to the
browser.

R.A.M. wrote:
Hello,
Could you help me plase? I need to set Text property of TextBox when
second page is displayed and active. On first page I have:
Birth date: <asp:TextBox ID="BirthDate" runat="server"
ValidationGroup="BirthDate" />
...
Session["BirthDate"] = BirthDate;
On second page I have:
<asp:Calendar ID="Calendar" runat="server"
OnSelectionChanged="Calendar_SelectionChanged" />
...
protected void Calendar_SelectionChanged(object sender,
EventArgs e)
{
if (Session["BirthDate"] != null)
((TextBox) Session["BirthDate"]).Text =
Calendar.SelectedDate.ToString().Substring(0, 10);
}
But it doesn't work - no visible result.
Could you tell me plase what's wrong? Thank you very much!
/RAM/

May 13 '06 #3

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

Similar topics

5
by: dixie | last post by:
I want to be able to set the font size and font type for text in a text box on a report using VBA. I wan't to be able to control it from a setting in a table. The problem is that I don't know the...
6
by: MLH | last post by:
You know how the text in the attached label sort of 'greys out' when you click something that sets MyTextbox.Enabled = False? I would like to make a label's text look like that? How do I do it?...
1
by: Rachel Suddeth | last post by:
I have an form where the whole display is a tab control (well, that plus a status bar.) I want to set the focus to the first TextBox on the first TabPage when it loads. I tried to put that into...
2
by: Jesper | last post by:
Hi, I'm showing a usercontrol containing a textbox on the screen by clicking a notifyIcon in the taskpane. I use textBox.Focus() to set the focus for the texbox, and I also get a blinking...
4
by: Gill Smith | last post by:
After setting the web control text box enable property to FALSE makes the control to loose the data between round trip. I am making sure that the property - EnableViewState = TRUE. Same code...
4
by: David Kyle | last post by:
Hello there, I'm having some problems setting the TextBox.Text Property in my code and having it returned to the client in the source when the TextBox.TextMode="Password". I know this is...
4
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several...
1
by: simon | last post by:
I have an unbound RTF2 control in an Access 2003 form which I set to show either unformatted text or else text with words and sentences highlighted. I do this by setting the PlainText property,...
1
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers...
18
by: Academia | last post by:
I let the use modify the text of a combobox and then I replace the selected item with the new text (in Keyup event). But if he sets the Text property to an empty string ("") that sets the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.