473,386 Members | 1,734 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,386 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 1309
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...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.