2014年7月13日 星期日

[RESOLVED] How to get new value from text-box in updating profile.??


Hi friends I designed webpage where people can login and after login they will be in profile page and on Profile page where Suppose these information is showing


First Name, Last Name , Email and these information are coming for database according to session


so on profile page there is Edit button when some one click on this so new page will be open where there is Coloumn


First Name:


Last Name:


Email :


and in these coloumn information are showing  which is coming from Profile page because on new page I set some coding so it takes information according to session from profile page problem is now suppose on new page when I am changing information and click
on Save button so information is not changing because text box is taking same value which is coming from profile page .


in short when you open page and some value are showing in text box and you can remove that value and fill new value and save on button so new value is not taking because in text box already value is filled so how I will referesh or do something else that
previous value can be vanish and new value can be taken in text box when I click on save button.



Make sure you are only loading the textboxes from the database when NOT ISPOSTBACK.  On the save button click you should then be able to save the new values in the textboxes to the database.



Yes Joy is right, load the text box in if(!isPostBack) and also have you written the Stored Procedure to update the profile as well?




Hi,




SACHIN2708



First Name, Last Name , Email and these information are coming for database according to session


so on profile page there is Edit button when some one click on this so new page will be open where there is Coloumn





Refer to the code:


    protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
//Load values from session to TextBoxes
//For example...
TextBox1.Text = Session["fname"].ToString();
TextBox2.Text = Session["lname"].ToString();
TextBox3.Text = Session["email"].ToString();
}
}

Hope it helps!


Best Regards!



Thanks a lot it works now,



use page not postback in page load event.


if(!Page.isPostBack)
{
// your code
}




沒有留言:

張貼留言