how to maintain scroll state between posts in MVC3 - asp.net-mvc-3

how to maintain the scroll state when Telerik grid Edit button is cliked.

You will have to capture the current scroll position with javascript and then store it on a hidden field, then on your action create a javascript to return the user to the same position and print it in the view so that it gets executed, that's how webforms does it.

Related

jqgrid: using setselection as if the user clicked on the row?

I have a grid (master/detail) with keys bound. I'd like to have the first row in the master grid automatically selected when the page starts.
I used setSelection in the GridComplete event and can get the row selected. However, the up/down arrows (and the detail grid) do not function until the user actually clicks on a row with the mouse.
Does anyone have any ideas about how to get a row selected programatically so that the grid operates as if the user had clicked the row?
Thanks,
-Bill
The problem is that the grid does not have focus, so keyboard commands are not routed to it when the grid is initially displayed. You can work around this by explicitly calling focus after setting your initial selection:
jQuery("#myGrid").setSelection(myID).focus();

Mvc Telerik Window does not post values of partial view

Good day,
I have the following scenario:
I have a Razor view with a "#using(Html.BeginForm(....))" statement at the top of the page. Inside the using statement I have a few textboxes, whose values get populated by the user, and a button.
At the click of that button, a telerik modal window (displaying a partial view of the same model as the initial view) pops up so that the user can populate some more fields. Inside the modal window there is a button that must submit the entire form, which it does, however after I debug my action, I notice that the model is missing the values which were entered in the popup (partial view).
My code for the telerik window resides inside the using statement and looks as follows:
Html.Telerik().Window()
.Name("AddEditScaleWindow")
.Title("Save Scale")
.Content(#<text>#Html.Partial("AddUpdateFeeScale")</text>)
.Buttons(e => e.Close())
.Height(250)
.Width(350)
.Modal(true)
.Draggable(true)
.Visible(false)
.Render();
I tried different methods of getting the window to post its values but to no avail.
If I view source, I can see that the window (partial view) is inside the form. If I do a network trace I can see that the values being posted are all values that were entered on the view, but none from the partial view.
Does anyone have any idea why the values inside the window don't get posted?
Thank you in advance.
Matei
You might need to check this because I am guessing, but many dialog renderers create their dom elements below document and outside of your Form element. If that is the case with Telerik, you will need to do a bit of work on the client to copy the values from the dialog back to your other form.

MVC3 Navigation, browser positionin g

I have a C#.NET MVC3 web app. I have a View that has a List of Models. This list can be long, requiring the user to scroll down on the View. When selecting one of the models in the View to Edit, the user is taken to the Edit View. After submitting the Edit View, the user is redirected back to the List View. However, the List View is now displaying back at the top of the list. How can I redirect the user back to the same position in the List View where they clicked the Edit button?
You would probably be better suited using a modal popup dialog to edit the data, rather than navigating to another page.
While it's possible to do what you want, it's a pain. You would have to get the scroll location via javascript, save it to a hidden field, post that to your edit page, along with record number and anything else, then re-post it back to your original page when you return, then read the post value and scroll to it via javascript.
All that is avoided if you just use a modal edit dialog, then when the dialog goes away the page is still in the same place.

UPDATE (Event) PROBLEM WITH AJAX ACCORDION CONTROL

I Have three records which I want to display in three Accordion Panes
which (every pane) will have a Header and a content ( Two label controls, 1 text box and 1 checkbox and 1 link button)
I am able to display data on the accrodion from database but when I am trying to Update the text in textbox by clicking link button the LINKBUTTON doesnot fire and unabel to make the update. How can we create Update event working ??
I am creating the Accordion Panes and Content controls statically and directly assigning the values to the controls from Code behind in Page Load.
I was able to do it using the "ItemCommand" event of the Accordion Panel by using the Command Name property of a Link Button which will update the Text Boxes.
It works for me now but I felt JQUERY will be a better option which has no postback, css issues..

RadCombobox doesnot maintain selected item

I have binded RadCombo on LoadonDemand Event. when i change page of radgrid, RadCombo looses its selected item.
How to maintain RadCombo selected item.
Please Help
Have you tried using the RadComboBox's trackChanges() and commitChanges() methods to preserve the selected item across post-backs?
http://www.telerik.com/help/aspnet-ajax/combobox-client-side-radcombobox.html
I'm assuming the RadGrid is not contained in a RadAjaxPanel because if it were this would be taken care of automatically through partial page rendering (i.e. only the RadGrid would be re-rendered when paging occurs). It would probably be helpful if you could post you page's markup.
When you page the grid is rebound and the controls inside it are recreated. To keep the combobox selection, save it Cache of Session object and then recover it from there wiring the PageIndexChanged event of the grid.

Resources