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

ASP:TextBox

I am a newbie to ASP.NET...

What I was trying to do... but yet to succeed in...

I am building a customer info database... and on default,
I want to display the customer's basic information in the
TextBox on Page_Load... but, also allow user to update the
information

For example: Street1 of the home address
ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>

but also allow update all within the same form on the same
text box to do the following...
ASP:TextBox id=dbStreet1 runat=server

I tried everything I know... but not works...

Please advise
thanks
Alex
Nov 17 '05 #1
6 7862
Try the attribute "text" instead of "value".

The best way to do this is declare an ASP textbox in the code-behind page
and assign the value of the variable to dbStreet1.Text from the Page_Load
event.

George Zacharias.

"Alex" <al******@gwu.edu> wrote in message
news:00****************************@phx.gbl...
I am a newbie to ASP.NET...

What I was trying to do... but yet to succeed in...

I am building a customer info database... and on default,
I want to display the customer's basic information in the
TextBox on Page_Load... but, also allow user to update the
information

For example: Street1 of the home address
ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>

but also allow update all within the same form on the same
text box to do the following...
ASP:TextBox id=dbStreet1 runat=server

I tried everything I know... but not works...

Please advise
thanks
Alex

Nov 17 '05 #2
Hi,

This is what I did...

Page_Load()
dbStreet1.Text = "whatever st"

Update_Text()
SQL update cmd ==> "update ..... dbstreet1='" &
dbStreet1.Text "' where <match critera>=<match this>"

Inside the HTML Main Body
<form method=post>
<ASP:TextBox id=dbStreet1 value=dbStreet1.Text
runat=server/>
</form>

It works on initial load.. where it takes the info from
DB... but the update doesn't seem to regonize the new value

Any clue?
thanks
Alex
-----Original Message-----
Try the attribute "text" instead of "value".

The best way to do this is declare an ASP textbox in the code-behind pageand assign the value of the variable to dbStreet1.Text from the Page_Loadevent.

George Zacharias.

"Alex" <al******@gwu.edu> wrote in message
news:00****************************@phx.gbl...
I am a newbie to ASP.NET...

What I was trying to do... but yet to succeed in...

I am building a customer info database... and on default, I want to display the customer's basic information in the TextBox on Page_Load... but, also allow user to update the information

For example: Street1 of the home address
ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>

but also allow update all within the same form on the same text box to do the following...
ASP:TextBox id=dbStreet1 runat=server

I tried everything I know... but not works...

Please advise
thanks
Alex

.

Nov 17 '05 #3
Hi,

This is what I did...

Page_Load()
dbStreet1.Text = "whatever st"

Update_Text()
SQL update cmd ==> "update ..... dbstreet1='" &
dbStreet1.Text "' where <match critera>=<match this>"

Inside the HTML Main Body
<form method=post>
<ASP:TextBox id=dbStreet1 value=dbStreet1.Text
runat=server/>
</form>

It works on initial load.. where it takes the info from
DB... but the update doesn't seem to regonize the new value

Any clue?
thanks
Alex
-----Original Message-----
Try the attribute "text" instead of "value".

The best way to do this is declare an ASP textbox in the code-behind pageand assign the value of the variable to dbStreet1.Text from the Page_Loadevent.

George Zacharias.

"Alex" <al******@gwu.edu> wrote in message
news:00****************************@phx.gbl...
I am a newbie to ASP.NET...

What I was trying to do... but yet to succeed in...

I am building a customer info database... and on default, I want to display the customer's basic information in the TextBox on Page_Load... but, also allow user to update the information

For example: Street1 of the home address
ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>

but also allow update all within the same form on the same text box to do the following...
ASP:TextBox id=dbStreet1 runat=server

I tried everything I know... but not works...

Please advise
thanks
Alex

.

Nov 17 '05 #4
Alex,

You have to read some fundamental books on ASPX programming - that's #1.
There are bunches and bunches of inexpensive, quick, easy books on the
subject.

The Page_load event fires on every trip to your page, so you are overwriting
the data changed on the site with the Page_Load event assignments.
.... so, your fresh, new values are trampled on when you post back to
update...

events fired in this order:

Init
Load viewstate
Process postback data (this is where your new data gets back to the
application)
Load (this is were you lose the data, and the original values are put back)
Send postback Change
Postback events
pre-render
save view state
render
dispose
unload

Learn it, love it, live it! :-)

"Alex" <al******@gwu.edu> wrote in message
news:00****************************@phx.gbl...
I am a newbie to ASP.NET...

What I was trying to do... but yet to succeed in...

I am building a customer info database... and on default,
I want to display the customer's basic information in the
TextBox on Page_Load... but, also allow user to update the
information

For example: Street1 of the home address
ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>

but also allow update all within the same form on the same
text box to do the following...
ASP:TextBox id=dbStreet1 runat=server

I tried everything I know... but not works...

Please advise
thanks
Alex

Nov 17 '05 #5
Dave,

Many thanks...

The sequence of load instructions solve my problem...
Basically I have everything else done right... Except, not
checking explicitly for POST during Page_Load...

I was basically counting on the even handler to trigger
the event..

Thank you
Alex
-----Original Message-----
Alex,

You have to read some fundamental books on ASPX programming - that's #1.There are bunches and bunches of inexpensive, quick, easy books on thesubject.

The Page_load event fires on every trip to your page, so you are overwritingthe data changed on the site with the Page_Load event assignments..... so, your fresh, new values are trampled on when you post back toupdate...

events fired in this order:

Init
Load viewstate
Process postback data (this is where your new data gets back to theapplication)
Load (this is were you lose the data, and the original values are put back)Send postback Change
Postback events
pre-render
save view state
render
dispose
unload

Learn it, love it, live it! :-)

"Alex" <al******@gwu.edu> wrote in message
news:00****************************@phx.gbl...
I am a newbie to ASP.NET...

What I was trying to do... but yet to succeed in...

I am building a customer info database... and on default, I want to display the customer's basic information in the TextBox on Page_Load... but, also allow user to update the information

For example: Street1 of the home address
ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>

but also allow update all within the same form on the same text box to do the following...
ASP:TextBox id=dbStreet1 runat=server

I tried everything I know... but not works...

Please advise
thanks
Alex

.

Nov 17 '05 #6

This event sequence, indeed, is discussed in several
ASP.NET with varying degrees of clarity. The major theme
in most books is to use the "if (!IsPostBack)..." logic to
get around the overwriting of variables in the viewstate.
However, I am observing a difference in behavior between
the asp:label control (where everything seems to work as I
expect and state is preserved via the viewstate) and the
asp:textbox where the state is not preserved in the
viewstate. What is happening here? I think Alex and I
are hitting the same problem.

Also, the instance of the asp:textbox seems not to have
been created in the init and when it is referenced in the
Page_Load an exception is thrown because the object isn't
there!

What is happening with the asp:textbox?
-----Original Message-----
Alex,

You have to read some fundamental books on ASPX programming - that's #1.There are bunches and bunches of inexpensive, quick, easy books on thesubject.

The Page_load event fires on every trip to your page, so you are overwritingthe data changed on the site with the Page_Load event assignments..... so, your fresh, new values are trampled on when you post back toupdate...

events fired in this order:

Init
Load viewstate
Process postback data (this is where your new data gets back to theapplication)
Load (this is were you lose the data, and the original values are put back)Send postback Change
Postback events
pre-render
save view state
render
dispose
unload

Learn it, love it, live it! :-)

"Alex" <al******@gwu.edu> wrote in message
news:00****************************@phx.gbl...
I am a newbie to ASP.NET...

What I was trying to do... but yet to succeed in...

I am building a customer info database... and on default, I want to display the customer's basic information in the TextBox on Page_Load... but, also allow user to update the information

For example: Street1 of the home address
ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>

but also allow update all within the same form on the same text box to do the following...
ASP:TextBox id=dbStreet1 runat=server

I tried everything I know... but not works...

Please advise
thanks
Alex

.

Nov 17 '05 #7

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

Similar topics

2
by: Kerri | last post by:
Hi, I have an asp textbox that allows users to enter their password. I have another page that allows a user to edit their user account. On this page I set the text to be the password in...
1
by: Ed West | last post by:
Hello, How can I put a textbox control into a cell of an asp:Table? I was not able to do it from the properties sheet, so I put it in via html tab, but now I can't select it from the Design tab...
1
by: Shilpi Chaudhry | last post by:
I have a forloop which I use to create textboxes - but unfortunately all of them have the same ids - I need to assign different ids to these textboxes creeated in the loop so that I can retrieve...
0
by: Luis Esteban Valencia | last post by:
am trying to databind within an asp:textbox control. I have tried many variations found here but nothing seems to work. It works fine if I use a regular HTML textbox input though. Here is what I...
3
by: Patrick | last post by:
Try to put in a TextBox next month's date in format (MMM yyyy). The following does NOT work, why is that? <!--When rendered, the texbox is blank, although the text in the round bracket after the...
0
by: datakix | last post by:
After 16 hours of frustration, I've managed to solve this problem for a project I'm working on. The 'trick' is set EnableViewState="False" for the asp:textbox inside the Repeater control. The...
11
by: Joe | last post by:
Hello All, I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton (SearchButton) server controls. The user can type search text in SearchTextBox and click SearchButton and...
0
by: CharlesA | last post by:
Hi folks, I'm using ASP.net 1.1 with C# I've got this kind of thing going <div class="row"> <label class="col1">Rm Name</label> <asp:textbox id="txtRM" runat="server" cssclass="col2"...
0
by: sjickells | last post by:
Hi I am having a problem using asp:TextBox's in a transparent table. I have a background image on the page and a table in the middle of the page. I have set the background colour of the table...
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: 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: 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
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
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.