开发者

Getting the Selected Value in a Template after document.ready

I have telerik MVC grid which has popup editor. I have set the popup editor to be my own custom template. What I need to do is show or hide certain controls based on what one of my dropdownlists has selected.

As it stands right now I have some jquery that handles the selected value change event for the droplist and this works fine, my only is开发者_如何学运维sue is that when the popup loads the value of the droplist it is always the first in the list regardless of what is selected. I know my droplist is binding to the model correctly because after the load is finished it selects the proper item in the list I just have the wrong set up controls showing up...

It's seems to me that I am having a timing issue... Is there anyway to check after the $(document).ready event has fired to get the proper value?

Any advice would be very much appreciated!


Forgot to update my answer to this... You need to put attach a method call to the client Events OnEdit:

gridBuilder.ClientEvents(Function(events) events.OnEdit("CallOnEditMethods"))

In my case I need to call a few so I just create on method that would fire several. This worked out perfectly!


Maybe if you rebind your grid it will help. You could use the .rebind() method but that will refresh your grid.

.ajaxRequest() seems to refresh a grid while retaining its current state, which would hopefully refresh the grid edit popup without interfering with anything.

var grid = $('#OrdersGrid').data('tGrid');
grid.ajaxRequest();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜