1

I have a custom form which has a gridview embedded in it and also a button that redirects to an other form. When the user fills the other form and saves it, it gets updated in the grid view in first form.

My problem is that when user fills up the data in first form and navigates to the 2nd form and returns the data entered in first form is lost. How do I save it even though user is actually not saving it? Is modal dialog way to go?
I tried this but I am losing form data,

In Page Load:

ViewState["PreviousPage"] = HttpContext.Current.Request.UrlReferrer.ToString();    

On Button Click in 2nd form:

HttpContext.Current.Response.Redirect(ViewState["PreviousPage"].ToString());    
0

Web pages are stateless. So either you should store the data before redirecting the users. In server side you can use caching/viewstate/session On client side you can use querystring/cookie

You can also use dialog's in that case the parent form will not lose the data.

  • Yea but I had very little success implementing the dialog boxes from server side. Can you please point me towards a link? – user25284 Oct 31 '14 at 18:09
  • Here is an article ashokraja.me/articles/… – Amal Hashim Oct 31 '14 at 18:11
  • I tried using the view state with above code, can you please point out any errors I am making? – user25284 Oct 31 '14 at 20:07
  • Post complete code – Amal Hashim Oct 31 '14 at 21:12
  • I added it in the question above. The whole code is too big to post. Is server.transfer of any use in my context? – user25284 Nov 3 '14 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy