problem with textboxes

J

Jeff

Hey

ASP.NET 2.0

I have a webpage which in the Page_Load event loads values into 2 textboxes,
these textboxes shows the values in these Profile properties. But if the
user changes the text in these textboxes and click on the save button (see
btnSave_Click ) the value saved are the values these textboxes reveived in
the Page_Load event -> no updated occured!

What should I do to fix this?

protected void Page_Load(object sender, EventArgs e)
{
txtFreeText.Text = Profile.FreeText;
txtWebsite.Text = Profile.WebSite;
}

protected void btnSave_Click(object sender, EventArgs e)
{
Profile.WebSite = txtWebsite.Text;
Profile.FreeText = txtFreeText.Text;
}
 
M

Mark Rae

What should I do to fix this?

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostback)
{
txtFreeText.Text = Profile.FreeText;
txtWebsite.Text = Profile.WebSite;
}
}

This is one of the most fundamental aspects of the the entire ASP.NET
structure. Do yourself a HUGE favour and buy a beginner's guide to ASP.NET.
 
J

Jeff

thanks


Mark Rae said:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostback)
{
txtFreeText.Text = Profile.FreeText;
txtWebsite.Text = Profile.WebSite;
}
}

This is one of the most fundamental aspects of the the entire ASP.NET
structure. Do yourself a HUGE favour and buy a beginner's guide to
ASP.NET.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top