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;

 

 

0
tamanna06
2/23/2009 8:46:46 AM
asp.net.getting-started 91979 articles. 3 followers. Follow

5 Replies
681 Views

Similar Articles

[PageSpeed] 26

tamanna06:
when a user clicks on edit profile link i am showing the ´new registration form with the user's data filled in.
 

the code block\routine\function in which you are showing the "new registration form with the user's data filled in" might not be under page.IsPostBack check.. thats why every time page post backs - controls are being filled again overwriting your entered data..

so, please check whether the data filling logic is written under IsPostBack check or not as:..

 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        { 
            //data filling logic 
            DataFillingCode();
        }
    }
    void DataFillingCode()
    {
        //code to fill the controls with data to edit
    }
 
hope it helps./.

Thanx,
[KaushaL] || BloG || Profile || Microsoft MVP

"I would love to change the world, but they won’t give me the source code"


Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
0
kaushalparik27
2/23/2009 9:55:28 AM

is you are disabling Text Box in javascript. if yes then LoadPostBack never calls.

try        Request.Form[email.UniqueID]


We All move to our original place.
Don't forget.

Imran Baloch
0
imran_ku07
2/23/2009 10:09:36 AM

Fill User Data in IsPostBack block.

Like:

 

if (!IsPostBack)
{
    FillData();
}
 
Hope this helps...


Don't forget to mark as answer, if this helps



Hope this helps...

Don't forget to mark as answer, if it helps
0
chintanpshah
2/23/2009 10:15:21 AM

You might need to set AutoPostBack to True for the textbox control.

Duardo

0
Duardo
2/23/2009 1:48:09 PM

no its still giving me the old value.

I have tried 2 ways..but

first i put the code inside ispostback..

if (!IsPostBack)

{

sEmail = email.Text;

}

 

2nd i added OnTextChanged event.

<asp:TextBox ID="email" runat="server" OnTextChanged = "changedText" AutoPostBack="True">

protected void changedText(object src, EventArgs e)

{

sEmail = email.Text;

}

but in both cases i am getting the old email that i am dispalying not the new edited email.

0
tamanna06
2/24/2009 9:18:39 AM
Reply:

Similar Artilces:

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...

problem in getting edited value of a textbox
hi, 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 demo@abc.com and the user changed it to demo123@abc.com then when i am doing String sEmail = email.Text i am getting demo@abc.com instead of  demo123@abc.com. here i...

Getting line number to show during editing, getting values to show during debug, getting MSDN help to know that I have it installed
G'day, Sorry I feel so dumb but these issues just push me over the edge. I've recently had to re-install VS and now none of these features that I once had now don't work.  I obviously have to tweak something but what?  It doesn't seem too obvious (I hope!)Help please!Thanks,Geoff Line numbers - that can found under Tools > Options > Text Editor > (Language) > (somewhere there, there is is a check box for line numbers) When you are in the debug mode of the IDE, go into the Debug > Windows > (whatever windows you need - locals/autos are what you're l...

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> ...

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 state...as 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......

POST GET GET GET GET... WTH?
Hi, I'm at a loss to explain this... I have an ASPX page that I can't always navigate to. When I developed the app (it's Starter Kit Portal-based), I did it on my LAN and have had no trouble accessing the page. However, upon deployment, I see the following behavior: 1. POST request goes out looking for MyForm.aspx 2. GET request for MyForm.aspx 3. GET request for MyForm.aspx 4. ... X. GET request Sometimes, the page finally loads. Other times, it just ends up blank. Many times, it doesn't load at ALL the first POST - I just get a "The pa...

Problem Getting Started
In have run the 1317set.bat file and still get the following error: Unable to get your db version please run version script against your db and restart your web application (go to update/scripts/ folder and run 1317set.bat). Any help to get me started would be much appreciated.www.creativenrg.co.uk | www.therivercard.com Have you checked your connection string? This is sometimes caused by a faulty db connection. I am new to Rainbow and get the same error when trying to run it for the first time. Does not matter which of the following I comment out in web.config: <!-...

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...

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 ...

Getting textbox value when all rows in edit mode
Hi There, I'm currently writing a small shopping cart for a site of mine. All rows are in edit mode so that a user can enter the qty's he/she desires and the click submit. I have an autopostback on the text box so that every time a value is changed, I return to the server to recalc the totals. The datagrid is defined as below (the text box in question is QUANTITY) : <form runat="Server"> <p> <asp:DataGrid id="BuyNowGrid" runat="server" AutoGenerateColumns="False" HorizontalAlign="Center...

Problem: Get new value when editting Datagrid
Hi All, I am trying to gather the new value, when I have finished edditing a particular column in my datagrid, but it still gives me the old value.. Must be that I dont extract the value correctly, because when I trace it the from collections show the new value.. dgList:_ctl2:txtAccount New Value Here is my code to get the new value in my update event.. Sub dgList_Update(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Dim objAccount As TextBox Dim sAccount As String Dim AccID As Integer AccID = dgList.DataKeys(e.Item....

problem while getting values from dynamically created textboxes
 Hi FriendsI have created some text boxes dynamically and I have problem while accessing their changed values. And I am using the following code. 1 TextBox t =(TextBox) this.form1.FindControl("field1"); 2 string name = t.Text;   When I try to execute the second line i.e. getting values from the text box, it results with Object reference not set to an instance of object. field1, fiedl2.... all are valid text box ids and they are present in the page.how to solve this? If you are using master page then field1 is changed to other name. Generally for objec...

Get values set by javascript to .net enabled textbox
I have a bit of javasript that writes a value to a text box.  The text box is read only. Textbox code:<input type="text" id="txtColor1" runat="server" readonly="readonly" size="6" /> Snippet from javascript functioncolorBox = document.getElementById('<%= txtColor1.ClientID %>');colorBox.value = colorCode;  Code behind:string color1 = txtColor1.Value Whenever I attempt to get the value out of the text box after it has been changed by the javascript, it always reverts back to the old data and not the new. Anyo...

Web resources about - problem in getting edited value from a textbox - asp.net.getting-started

Problem novel - Wikipedia, the free encyclopedia
Working class, or proletarian novels are often also social problem novels . This was in many ways a reaction to rapid industrialization , and ...

The problem with using infrastructure to stimulate an economy
The immediate boost to the economy from infrastructure stimulus spending is minimal, while the cost for any new jobs it creates can be huge

The problem with “bringing the country together”
... our country needs is to reject the very premise of politics. The disparate factions in the United States don’t even agree on what our problems ...

Apple confirms bug that makes the iPhone’s most frustrating problem even more frustrating
... as and satisfied as they are though, we doubt any iPhone user would make the claim that his or her handset is perfect. No, iPhones have problems ...

A recurring problem in 'Making A Murderer' used to be huge in the UK — and the country figured out how ...
... Act of 1984 [PACE], however, subsequently required officers to videotape their interviews, among other provisions. It nearly solved the problem. ...

The problem with Chinese data...
John Rutledge, Safanad chief investment strategist, shares his thoughts on China's GDP and real economic growth. And Mike Santoli, CNBC senior ...

‘Degrassi: Next Class’: “The Drugs Have Changed But The Problems Are Still The Same”
Degrassi is known for tackling the complex issues that high school students face. Subjects such as teen pregnancy, drugs, school shooting and ...

Fujitsu wants to fix Japan's deer problem with software
Fujitsu is teaming up with a Japanese forest research institute to learn how animal populations grow. The pair will look into Sika deer, a creature ...

Free Basics, net neutrality, and the problem with charity
This must have been a pretty bad year for Mark Zuckerberg. He thought he'd be a hero, but now he's a pariah. Why?

Apple Admits iOS 9.2 Has A New Problem
Apple says it is working hard on a fix...

Resources last updated: 1/19/2016 11:06:45 AM