Last post Jul 27, 2017 01:15 PM by JBetancourt
Jul 24, 2017 06:12 PM|gunderj|LINK
For my MVC app I have a input field filter that is in a div near the bottom of the page. When user scrolls down the page and types into the filter I want the same input field to show after the pass to Controller. Since the input field is in a div that
is toward the bottom of the scrollable page, I need to simulate the page scroll after coming back from the Controller. How can I have the page look the same (in terms of how much scrolling was done initially) after coming back from the Controller?
Jul 24, 2017 06:57 PM|JBetancourt|LINK
You can add a hashtag to the page that will scroll to the div with that id or name
will scroll to
you could also refer to this article that explains hot to scroll to a specific element:
but for a perfect effect make an ajax call instead of a redirect, that way your page wont move
Jul 25, 2017 06:43 AM|Eric Du|LINK
According to your description, I know you want to fix the div at the bottom of the page when scroll the page, I know you could use the following code to fix the div:
I don't know my understating if is right, if not, please correct me!
Jul 25, 2017 01:10 PM|JBetancourt|LINK
I dont think he wants a fixed div but to simulate no postback by leaving the user where it was before the postback. as I said the ideal would be not to do the postback but do an ajax call to do what ever
gunderj wants to do without a page round trip to the server
Jul 26, 2017 03:48 AM|gunderj|LINK
Your idea sounds exactly what I am looking for. I have not yet used ajax and hopeful that I would not need to start at the beginning...?
What sort of ajax call would I make to get the Controller to issue a new query and pass back data via return view? If it means rewriting MVC Controller I'll search for something else. Thanks.
Jul 26, 2017 01:31 PM|JBetancourt|LINK
its easy, do a jquery "load" call to the method in your controller that returns the partial view, "load" will fill the element specified with the partial:
refer to : https://www.w3schools.com/jquery/jquery_ajax_load.asp
<h2>jQuery and AJAX is FUN!!!</h2>
<p id="p1">This will be orverwrite with the partial.</p>
This is the different question than the original, please mark both as answers if you think they helped you solve the issues
Jul 27, 2017 01:15 PM|JBetancourt|LINK
did you solved your issue, please mark as answers the 2 responses that solved your 2 questions