|
-
Jul 22nd, 2003, 12:08 PM
#1
Thread Starter
yay gay
text box text wont change
i have a asp.net page that has some text boxes with some text in there..then i have a submit button..the problem is that when i try in code to get what the textboxes have in the .Text property i get what i've put when the page loaded and not what actually the user has written! anyone has experienced this? what am i doing wrong?
help!!!!!!!!!!!!!
\m/  \m/
-
Jul 22nd, 2003, 12:50 PM
#2
PowerPoster
You just not checking for post back...like I said in the other thread, post your code (especially your load event code) and I will show you how to use it properly to ensure things like this don't happen.
-
Jul 22nd, 2003, 01:29 PM
#3
Thread Starter
yay gay
load event
Code:
WebMessage web = Serializer.BinDeSerializer(Server.MapPath(@"Logs\" + Request.QueryString["File"]));
msgTxt.Text = web.Message;
titleTxt.Text = web.Title;
nickTxt.Text = web.Author;
\m/  \m/
-
Jul 22nd, 2003, 01:30 PM
#4
Thread Starter
yay gay
post(edit)button
Code:
case "EDIT": {
Debug.WriteLine(titleTxt.Text);
string filename = Server.MapPath(@"Logs\" + Request.QueryString["File"]);
WebMessage oldMsg = Serializer.BinDeSerializer(filename);
if (File.Exists(filename)) {
File.Delete(filename);
}
WebMessage newMsg = new WebMessage(
titleTxt.Text,
msgTxt.Text,
nickTxt.Text,
DateTime.Now,
oldMsg.Comments,
Path.GetFileName(filename));
Serializer.BinSerialize(newMsg, filename);
Response.Redirect("Log.aspx?&Action=POST", true);
break;
where titleTxt,msgTxt,nickTxt are the TextBoxes which arent changing the text
\m/  \m/
-
Jul 22nd, 2003, 02:24 PM
#5
PowerPoster
In your page load event, check for Page.IsPostBack.
Code:
if (!Page.IsPostBack) {
// Perform your initialization (db calls, etc..)
}
-
Jul 22nd, 2003, 02:28 PM
#6
Thread Starter
yay gay
still not working...i dont get what would help checkin if it is postback or not lol..because if it is postback and now is not working then checking for it wont help, if it isnt and isnt working by checking i will not do it work..so *** can i do?
\m/  \m/
-
Jul 22nd, 2003, 02:31 PM
#7
PowerPoster
Because we are working in a stateless environment. Everytime a postback occurs, the page_load event fires off before any of the control event(s) that caused the post back. So, if you reset the values in the load event, then in your event handler, you are still dealing with the initial default values.
-
Jul 22nd, 2003, 02:32 PM
#8
PowerPoster
Change to this:
Code:
if (!Page.IsPostBack)
{
WebMessage web = Serializer.BinDeSerializer(Server.MapPath(@"Logs\" + Request.QueryString["File"]));
msgTxt.Text = web.Message;
titleTxt.Text = web.Title;
nickTxt.Text = web.Author;
}
-
Jul 22nd, 2003, 02:34 PM
#9
Thread Starter
yay gay
hmm....even with hellswraith code it doesnt work..
\m/  \m/
-
Jul 22nd, 2003, 02:36 PM
#10
PowerPoster
Well, the code I posted is the exact same, so it wouldn't work (minus the three lines of code)
Post your entire code-behind, it's something else..
-
Jul 22nd, 2003, 02:42 PM
#11
Thread Starter
yay gay
hmm my page is getting a bit confusing, since its only my 2nd asp.net project and i wasnt expecting for somethings i had to implement..i will make a new architecture for the site and then i will try again and if it doesnt work post it here again..but i need to implement cookies..anyone could answer by other post about cookies plz?
tks by ur answers btw
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|