Solved

Problem to take value of TextBox in C#

Posted on 2011-03-14
4
215 Views
Last Modified: 2012-05-11
Hello... well i need take a value of textbox

I have a textbox in my page and the user, insert a new value, next when click on button the information is save in DB... but I recieve 0 that it's the value of TextBox before changed...

I try with

string value= TextBox1.Text;

but it doesnt work...
0
Comment
Question by:tenriquez199
4 Comments
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
What kind of application are we talking ? Windows or webbased ?
When you execute the update, does it store the new value or is the value never changed ?
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
How do you test what value is saved in the database?
0
 
LVL 18

Accepted Solution

by:
Ajay Sharma earned 500 total points
Comment Utility
Is your textbox value getting set into the Page_Load metho?
If yes then set it inside the below condition:

If (Page.IsPostback==false)
{
txt.Text = "0";
}


Also, post your page code, it will help us in better understanding the code.
0
 
LVL 1

Author Closing Comment

by:tenriquez199
Comment Utility
yks
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Article by: Ivo
Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now