Click to See Complete Forum and Search --> : Saving results from SQL Query to string or textbox?
Ullvantar
March 20th, 2006, 07:22 AM
I'm trying to do an edit button for my current project in school, being a forum. What I wanna do is that when you press edit you come to a screen where you have like a new post but with the old message in the textbox. I can get the select query to work but I cant save the result to a textbox nor string so Im wondering if there is any way to do either of this?
So, basically I check on pageload if it is edit and if its true then put the old message in the text area for editing.
Thanks.
EDIT: Uh and I use C# :P
mcmcom
March 21st, 2006, 07:58 PM
you shouldn't pass the whole thing through the query string, you could make a public static class or hashtable that you can load the message in from the first page, and access it from page two to load all the controls.
Alternatively, you could store the message parts in a Session variable, just make sure to dispose of it after your done.
//when you press the edit button
Session.Add("tmpForumSubject", this.txtSubject.Text.ToString());
Session.Add("tmpFormMessage",thsi.txtMessage.Text.ToString());
//and on the new page's load event
this.txtSubject.Text = Session["tmpForumSubject"].ToString();
this.txtMessage.Text = Session["tmoForumMessage"].ToString();
hth,
mcm
Ullvantar
March 22nd, 2006, 01:56 AM
Thanks for the answer but I managed in another way. Oh and I didnt send the message through the query string. Just the ID for the post and then I retrieved the message from the database :)
mcmcom
March 22nd, 2006, 10:37 AM
works just as well
good one
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.