views:

317

answers:

1

I have been using telerik extensions for an asp.net mvc project, more specifically the tabs.

Im loading my tabs contents via ajax.

One of my returned ajax files is a form that has a date field. I want to be able to use telerik datepicker but it doesnt work.

Im sure it has something to do with $(document).ready() already being executed or something... please help.
My ajax returned file has this

<% Html.jQuery().DatePicker().Name("DateofBirth").AllowYearChange(true).Render(); %>

but im not initializing telerik again, since it's already on the master page.

Edit:

Ok, Im gonna make myself clearer now that I have more time.

My site is made of a Jquery UI Tab using Telerik extension. Each tab loads a file through ajax. (again, using the telerik helpers.) The line I showed before is inside a aspx file that doesnt use any Master Page, cause its gonna be loaded with ajax. The examples shown on their website only load text through ajax. What Im doing is loading a complete form (but for the purpose of the question the only thing that matters is the date input field) The datepicker is supposed to show you a popup thing so you pick a date. What I meant by "it doesnt work" is that it doesnt show me the popup at all.... the reason is that I have already run the function

    <%
Html.Telerik().ScriptRegistrar()
              .Render();%>

in my master page...

I have to find a way to bind the loading of the tab to a new generation of javascript necessary code.

If you guys havent used this extensions you wont understand what I mean. Telerik somehow keeps track of which jquery ui funcions you want to use and then when you run sciptregistrar.render it creates your required javascript code.....

+1  A: 

Hi,

We are currently not supporting this scenario. Some browsers will not automatically include and evaluate JavaScript statements returned as part of Ajax response. That's why those are handled separately by ASP.NET Ajax. Right now the only solution seems to be manually executing the JavaScript code required to initialize the datepicker. I suggest you send me a sample project at atanas DOT korchev AT telerik.com. I will try to workaround this issue.

korchev
Well, what I did was create a function behavior(){$(".date").datepicker()}and add onload event behavior to the tab onload event.
NachoF