Please, does anyone knows where is the problem ?
I′m new with ajax and I lost many hours making searching and testing , but i didn′t find an answer.
The problem is :
I have a webform with one textbox and one button (just to make tests)
in the code I have
try
{
Produto m = new Produto();
m.idProduto = textbox1.Text; //in this case I will force a primary key error
newGenericDAO().salva(m); // saving the object}
catch (Exception problema){
Session.Add("msgErro", problema.Message);Response.Redirect("~/frmErro.aspx");
}
And I redirect the program to a webform error, everything all right until here, but when i go back the textbox.text is empty ??
Why i′m losting the textbox value ? with AJAX it′s necessary to save the objects of webform in the session before use redirect ?
if I make other solution without AJAX works welll
Please, if anyone knows the answer............
thanks, Valmir
Hi vmorikawa,
I think you are using Update Panel...
There is a problem with Response.Redirect when you use Update Panel.
Try using Server.Transfer
Cheers,
Radiant
Hi Radiant , thank you very much for your help. Yes I′m using UpdatePanel and I try to change Response.Redirect to Server.Transfer and now I have the message:
--------
Windows Internet Explorer
--------
Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
Any Idea ??
Response.Redirect is allowed in UpdatePanel not the Server.Transfer. Regarding the texbox gets empty, i suggest that you check the other parts of your page and ensure that it does not explicity set the textbox content to empty.
No comments:
Post a Comment