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

textbox question

Lets say I have a page that has a Button control and a Table control.
The Table control holds a textbox that gets its text from a DB. Now
when i click the Button control I want whatever text in the TextBox
to be saved to the DB. So it would be like an update.

My problem: When I click on the Button control the text in the TextBox
doesn't get saved...the old text from the DB is loaded because before
the Button_Click event is fired the Page_Load method is called and
that resets the TextBox to the original text from the DB.

How can i over come this? (The example above is simplified so
viewstate wont help).

Thanks.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 18 '05 #1
2 1637
Check IsPostBack in Page_Load.

Eliyahu

"ProgramAnalyst" <al**********@scotiabank-dot-com.no-spam.invalid> wrote in
message news:41**********@Usenet.com...
Lets say I have a page that has a Button control and a Table control.
The Table control holds a textbox that gets its text from a DB. Now
when i click the Button control I want whatever text in the TextBox
to be saved to the DB. So it would be like an update.

My problem: When I click on the Button control the text in the TextBox
doesn't get saved...the old text from the DB is loaded because before
the Button_Click event is fired the Page_Load method is called and
that resets the TextBox to the original text from the DB.

How can i over come this? (The example above is simplified so
viewstate wont help).

Thanks.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 18 '05 #2
check out this tutorial on isPostBack:
http://aspnet101.com/aspnet101/tutorials.aspx?id=3

David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
"ProgramAnalyst" <al**********@scotiabank-dot-com.no-spam.invalid> wrote in
message news:41**********@Usenet.com...
Lets say I have a page that has a Button control and a Table control.
The Table control holds a textbox that gets its text from a DB. Now
when i click the Button control I want whatever text in the TextBox
to be saved to the DB. So it would be like an update.

My problem: When I click on the Button control the text in the TextBox
doesn't get saved...the old text from the DB is loaded because before
the Button_Click event is fired the Page_Load method is called and
that resets the TextBox to the original text from the DB.

How can i over come this? (The example above is simplified so
viewstate wont help).

Thanks.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 18 '05 #3

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

Similar topics

2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: Devinim ÞÖLEN | last post by:
Hi; I try to fetch data and show in the textbox as follows; .. .. .. .. <asp:XmlDataSource Id="m_ChXmlDataSource" runat="server"...
3
by: Henry | last post by:
Hi. I've also posted this at another discussion board and here is the original question. ------------------------- "I have this problem and I don't know what I can do. First of all, I have a...
2
by: Jon | last post by:
Hello All, I have a datalist whose itemtemplate contains a label and a textbox. The label text is set on itemdatabound with the text, which is a question, from the database column. Each question...
0
by: jason | last post by:
Hello everyone. I am trying to write some custom command events into a DataGrid. The command that is currently giving me trouble is an "Add" custom command in the footer of a template column. ...
1
by: melanieab | last post by:
Hi, If there's a textbox and the text entered is longer than what's visible (the textbox length), how do you make it so that the beginning chunk of text is visible (instead of the last part of...
13
by: WALDO | last post by:
I have a .Net TextBox (TextBoxBase, really) in which I am appending about 20 lines of text per second. I use the AppendText() method to accomplish this. This is a great substitute for taking the...
1
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
10
by: garyusenet | last post by:
I have a multiline textbox. The size of the text box should be 75 characters wide, and 5 lines in height like this: - <---75 characters--> <---75 characters--> <---75 characters--> <---75...
4
by: Randy | last post by:
My situation is that I have a form on which a number of textboxes and comboboxes are added dynamically based on interaction with the user. As these controls are added, they are given names based on...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
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...

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.