Popup Dialog Not Re-drawing after initial launch
I have a dropdown listbox on my main page with a button on the same page that launches a pop-up dialog box, also having a dropdown list box. I need the selected index of the 1st listbox control to be synched with the pop-up dialog dropdown listbox.
I have added code to my Controller that sets the index in the ViewData object to be retrieved by the popup and it works on the initial launch of the App. My problem is any subsequent launches of the pop-up dialog won't hit its corresponding code to set the index using the ViewData. The code that needs to be executed is:
<%= Html.Telerik().DropDownList()
.Name("DataStoreTypeId")
.BindTo(new SelectList(Model.DataStoreTypes, "DataTypeId", "Name",Model.DataTypeSelectedId))
.HtmlAttributes(new { style="width:205px })
.SelectedIndex((int)ViewData["SelectedIndex"])
%>
Coming from an ASP.NET background, I am accustomed to having postbacks as mechanisms to handle these types of actions, but MVC has trimmed the postback events which is great for performance but what are my options to force code execution now?
Should I be using开发者_开发技巧 other alternatives?
First time it works because its value is set on server side. once its rendered in the browser there is no server side left. you have to manually change the selected value of your telerik dropdown list on button click event next to your first drop down list (is first DD also telerik dropdown or html one). For client events of telerik dropdown have a look at Telerik Demos for asp.net mvc
精彩评论