[SOLVED] Â Redirecting within button code |
6/8/2016 10:05:23 AM |
ASPRunner.NET General questions | |
![]() I've been pulling my hair out all morning, trying to figure out why this line MVCFunctions.HeaderRedirect("UserInformation","list");
location.href="http://cnn.com";
|
|
![]() |
Pete K author 6/14/2016 |
Well apparently MVCFunctions.postvalue() also does not work in the context of the server-side code of a custom button. Neither does Request.QueryString. I don't understand how this works and why parts of the asp.net framework are unavailable in this context. It's as if the "OnServer" function exists apart from the page. |
![]() |
Sergey Kornilov admin 6/14/2016 |
Button's code is executed via AJAX. It doesn't submit the whole page but does a separate request to buttonhandler.cs file behind the scene, runs server code and returns results back to the main page. This is why you cannot use server side redirect or cannot use Request.QueryString. What you need to do is to pass value from the main page to button's code. |
![]() |
Pete K author 6/14/2016 |
Button's code is executed via AJAX. It doesn't submit the whole page but does a separate request to buttonhandler.cs file behind the scene, runs server code and returns results back to the main page. This is why you cannot use server side redirect or cannot use Request.QueryString. What you need to do is to pass value from the main page to button's code. See example #6 at http://xlinesoft.com...ting_button.htm on conditional redirects.
|