problem in getting edited value of a textbox


I have a textbox inside a usercontrol registration.ascx.

<asp:TextBox ID="email" runat="server" Width="260px"></asp:TextBox>

when the user wants to edit his account then this textbox is populated with the email address that the user is using currently.

the problem is that when the user edits the textbox then I am unable to get the edited value. Say the old email id is and the

user changed it to then when i am doing String sEmail = email.Text i am getting instead of

here is some part of my registration.ascx.cs file:

 protected void Page_Load(object sender, EventArgs e)


String temp1 = Session["editform"].ToString();

if (Session["editform"].ToString() == "Y") // If edit mode


ListDb = dataConnection.getSql(
"SELECT email FROM user where id_user ='" + sUserId + "'");if (ListDb != null)


email.Text = (String)ListDb.Data.Rows[0]["email"];




protected void save_Click(object sender, ImageClickEventArgs e) // when click on save changes


if (Page.IsValid)


sEmail = email.Text;


if (Session["editform"].ToString() == "Y")


dataConnection.getSqlVal("UPDATE user SET email='" + sEmail + "' ' where id_user ='" + sUserId + "'");





plaese tell me where I am wrong..

2/27/2009 1:35:03 PM 93655 articles. 6 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 49

The problem, I think, is that in Page_Load you are setting the value of the email textbox.  So when they click the save button, the value is reset in Page_Load prior to reaching the click handler.  Check if (!IsPostBack) to set the email textbox on first page load.

C# <---> VB.Net Translator
2/27/2009 3:56:56 PM

hey..thank you so much..problem solved..

3/2/2009 10:16:54 AM

Similar Artilces:

Trying to edit web form, can't get database updated with newly edited values.
 This is my code:  when I try to update any of the fields, the update statement retains the old values retrieved from the database.  Could you tell me where my code is bad? -Thanks, Mark   <%@ Page Language="VB" %><%@Import Namespace="System.Data"%><%@Import Namespace="System.Data.SqlClient"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""><script runat="server"> Protected Sub Page_Load(ByVa...

problem in getting edited value from a textbox
hi, when a user clicks on edit profile link i am showing the ´new registration form with the user's data filled in. The problem is that when the user edits his data and clicks on the save button i am not getting the new edited data. Instead of giving me the new data textbox.Text is giving the same old value that I am displaying. what I need to do to get the new value? <asp:TextBox ID="email" runat="server" Width="260px"></asp:TextBox> sEmail = email.Text;     tamanna06:when a user clicks on edit profile link i am showing the ...

problem with get value from textbox after get it value in load page
hi every one  i have problem with my web site when i get textbox value in load page   and Changed textbox the page do not take last value .   it take value in load page   this is code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)   TextBox1.Text = "aa" End SubProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox(TextBox1.Text) End Sub   when i press button message write "aa" while i changed the textbox   please if enyone knowen help me &nbs...

getting values from a web form to windows form
Hot Requirement ..... Is there any possible of getting values from a web form to windows form ????? Yes One way i to use the WebRequest and WebResponse classes of the System.Net namespace. For example:  WebRequest request = WebRequest.Create("URL of the web page); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string content = reader.ReadLine(); ....    Reza Nassabehwww.professionalcsharp.comDon't forget to click "Mark as Answer" on the post that helped you. That way fut...

hei guys, i need help on my application, i'm using C#.NET as front-ed and SQL as back-end, aside from a datagrid, i want to display my data using textboxes and not a datagrid, i can do it using Visual Basic 6 but since i'm a newbee at C#.NET i don't know how to do it, specially the codes, can anyone help me with it? thank you in advance! If you are doing windows development, i would suggest using 'DataForm wizard' (Use Solution Explorer-->Rightclick project-->Add new Item-->New DataForm). It will guide you through steps. If you are doing web apps. Use quickstart to learn them. h...

Problem with getting the value from a textbox
Hi I have a shopingcart with a gridview containing the products in the shopingcart, a textbox for changing the quantity and a button for submitting the change. The textbox first holds the current number of a product, but the user should be able to change this. How do i get hold of the value in the textbox? Here's some code: The gridview (or relevant parts of it):   <ItemTemplate> <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Antal") %>' Width="20px"></asp:TextBox> ...

Passing Values from a Web Form to Another Web Form
Hello All! I am trying to pass values from one web form to another web form. I know that there are 3 ways of doing this: queryString, Server.Transfer and Session. I am using the Server.Transfer method. But I am not able to create, in my 2nd web form, an instance of my 1st web form. My 1st Web form is named CallTrack.aspx and my 2nd is named Export.aspx. What I mean is something like this: Public value as CallTrack. I can't create it in my 2nd web form because when the intellisense is displayed, there's no CallTrack in the options. Thanks!   How about using cross-...

problem with getting textbox value
when i pressed button add, the following code would add a text box to datagridTextBox txtEdit = new TextBox();dgTest.Items[0].Cells[0].Controls.Add( txtEdit ); After that i pressed button delete, the following would remove the textbox from datagridTextBox txtEdit = ( TextBox ) dgTest.Items[0].Cells[0].FindControl("txtEdit");// lblTest.Text = txtEdit.TextdgTest.Items[0].Cells[0].Controls.Remove( txtEdit );What i can not understand is that it removed the textbox sucessfully that means it could find the textbox but it can't not get the text that i typed in the textboxThanks TextBox txt...

How to get edited value of the textboxes???
Hi, I am having 4 textboxes with field name,address,phone,email .... OnLoad they get filled with database values....and all fields are in inactive user click the edit button,  all textboxes get active and user can edit the values in it.....Now after editing values, as user click UPDATE button, All edited values should get updated in the database....My update query working fine...But the Problem is that Update query not getting edited value.....getting only the value filled during the load time..... Please help me ...How can i get the edited value in the update query......

How to get the HREF value of the Anchor tag in a web page using the web browser control in
Hi Friends,               i have a webserver control in my application.i load the web browser control on a button click using the below code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click                AxWebBrowser1.Navigate("", False) End sub once the page is loaded in the browser i want the <a> HREF value in that page.For example if that page has ...

problem with getting the value from the Child Form
Hello,    i Have one Dropdownlist and Button on my Child Window and i want to get the selectedvalue of this dropdrown in my Parents window on the click of button and also i want to closed the Child window. Here i writedown the code below. Parent Window link  <input name="txtAirportCode" type="text" runat="server" class="formStyle1b" id="txtAirportCode" /> <a href="#" onclick="'Airport.aspx?text=txtAirportCode,null,'width=800,height=400,left=270,top=180')">Change Airport </a>   and in my Child Window ('Airport.aspx) <asp:DropDownList...

Problem getting TextBox Value in DataList.
hai guyz, i'm having a problem getting value from TextBox in the DataList Control. My situation is, i got one "Add to Cart" button,when user press the button it will trigger the Code below (catalog.aspx.cs ).It found the textbox control but can't get the value that i entered.Any idea guyz?.catalog.aspx<form id="Form1" method="post" runat="server"> <asp:datalist id="DataList1" runat="server" GridLines="Horizontal" RepeatColumns="1" OnUpdateCommand="DataList1_Update"> <ItemTemplate> <asp:LinkButton CommandName="Update" Runat="server" ID="lnkAdd...

Get listbox value from the other web form
 Dear all, I want to get the lisbox selecteditem value to a textbox in one web form from the other web page. Should I use session to get this value?Can any one help in this regard? Thanks a lot in advance.  People Develop People Yes you can use Session to get the informations between cross pages.. see below for your referenceTO STORE THE INFO in Session Session["key"] = ListBox1.SelectedItem.Value; Response.Redirect("Page2.aspx");TO GET THE VALUES FROM Sessionprotected void Page_Load(object sender, EventArgs e){    if (Sessio...

problem getting textbox values dynamically
Ok I am trying to loop through a table (tbltest) get all of my textboxes. and assign there .text to a database. Here just to simplify I have been trying to just assign it to a label. here is the code. Dim c As Control For Each c In tbltest.Controls lbltest.Text = c.text Next Problem is it won't let me use .text. anyone know a way around this one. Or am I doing something else wrong? Something like this is probably what you are after: Dim c As Control For Each c In tbltest.Controls 'Is the type of c a TextBox ...

Web resources about - problem in getting edited value of a textbox -

Is–ought problem - Wikipedia, the free encyclopedia
The is–ought problem in meta-ethics as articulated by Scottish philosopher and historian David Hume (1711–76) is that many writers make claims ...

The problem with celebrity charities
THE world erupted in praise this week for one of the most generous acts in history.

"Old-timers, guys that are 60-plus, have no problem with a gang shower and whatever."
"The Gen X-ers are a little bit more sensitive to what they’re spending and what they’re expecting. And the millennials, these are the special ...

Apple's App Store has a copyright problem
... then made more apps — all of which are paid-for — and Raub says Apple is unwilling to help this time. 9to5Mac points out that this problem ...

Rahm Emanuel op-ed: I own the problem of police brutality, and I'll fix it
Chicago is facing a defining moment on the issues of crime and policing and the even larger issues of truth and justice. To meet this moment, ...

Out-Of-Town Trip In The Nissan LEAF — No Problem
... driving to St. Petersburg, to Tampa, or south to Venice or Englewood is gone. The [&hellip Out-Of-Town Trip In The Nissan LEAF — No Problem ...

Michigan GOPer Blames School Problems On Black Children
Michigan state Senator Marty Knollenberg decided he'd be a wise guy and blame failing school districts on African-American kids during a debate. ...

Tallahassee Police Finally Admit Problems With Investigation Of Jameis Winston Rape Case
One of the most sinister things that came to light in the Jameis Winston case was how Florida State and local police protected athletes accused ...

Thursday's Must-Reads For Entrepreneurs: The Abandoned Shopping Cart Problem
Today’s news and insights for business owners, including: Does Gravity's Dan Price have something to hide?

Resources last updated: 12/6/2015 12:50:15 PM