I cannot figure out how to use the Window in a typical fashion. Basically, I want to define a window, but have it be closed initially. I want to click a link and have the window open. I have tried using the client API to create an open a window using the following, but I get a browser error "Line: 50
Error: '$.telerik.window' is null or not an object".
Then I tried using the server side API, thinking I could close the window with the onLoad event handler and I get "Line: 58
Error: 'undefined' is null or not an object"
All I want to to define a window, have it be closed when the page loads, and use a link to open it. Any advice anyone?
10 Answers, 1 is accepted
@Philip: The solution is, like Carlos said, to use the Visible(false) property in the view and show the window by calling its open() client-side method.
@Joshua: It seems that this is a bug -- alas I couldn't reproduce it. Could you please send your window declaration and how you are using it, so that we can fix this for the upcoming release?
the Telerik team
Yes, using .Visible(false) prevents the window from opening OnDocumentReady().
I did not understand how to implement your suggestion "showon the window by calling its open() client-side method." because I am new to JQuery.
I used the code in the Telerik Window example but the window opens and then closes immediately when I click the link that triggers the call to open the Telerik window.
Any suggestions on how to fix this would be appreciated.
<a href="#" id="popup">Open Telerik Window</a>
Leaving the rest in case anyone else has this issue.
I am having the same issue as Phillip. Any advice is very much appreciated.
I am editting this post as I think I may know some of the issue I am having. I am using LoadContentFrom and hitting a different action which loads a partial view into the window. But it seems that Telerik is also doing a post back on the main action, maybe because I am using a button. I will do more research and testing and will edit again if I come up with the answer. In the meantime, if anyone has suggestions, I'm all ears.
Here's my code:
> I did not understand how to implement your suggestion "show the window by calling its open() client-side method." because I am new to JQuery.
$('#MyLovelyWindow').data('tWindow').open();line does that - it gets the DOM object ($('#MyLovelyWindow')), then it gets the client-side object of the window (.data('tWindow')) and calls its open() method.
Your page makes a "post back" (i.e. navigates) because the #undo link is being clicked. The empty href attribute means that clicking it will reload the current page. You can either (a) set the href to a hash (#) or (b) call e.preventDefault in the click handler (openWindow), so that the navigation won't happen. I recommend doing both.
@Donna, Joshua - I am glad that you were able to fix the issues.
the Telerik team