or
@{Html.Telerik().Window() .Name("Window") .Title("Student Window") .LoadContentFrom(Url.Action("AddReason", "Reason", new { id = reasonID }, Request.Url.Scheme)) .ClientEvents(events => events .OnClose("ClosingWindow") ) .Draggable(false) .Scrollable(false) .Width(800) .Height(600) .Modal(true) .Visible(false) //.Effects(fx => fx // .Zoom() // .Opacity()) .Render(); }<script src="@Url.Content("~/Scripts/jquery-1.4.4.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/spin.min.js")" type="text/javascript"></script>function DoOpen(id) { var url = '@Url.Action("AddReason","Reason")'; $.post(url, { id: id }, function (data) { var window = $('#Window').data('tWindow').center(); window.content(data); window.open(); }); }$('#Window')) and
alert($('#Window').data('tWindow')) they both return null
function ClosingWindow() { $('#Window').prop("checked", "checked"); $('#Window').data('tWindow').close(); window.location.href = window.location.href; }@model Student.Models.Reason@using Student.Example@{ ViewBag.Title = "Add Reason"; Layout = "~/Views/Shared/_PartialReason.cshtml";}<script type="text/javascript"> function CloseWindow() {// alert($("#Window").closest('.t-window').data('#tWindow'));// $("#Window").data("tWindow").close(); $('#Window').prop("checked", "checked"); window.location.href = window.location.href; } </script>@using (Html.BeginForm("AddReason", "Reason", FormMethod.Post)) { @Html.ValidationSummary(true) <fieldset> <div class="editor-field"> @(Html.Telerik().Editor() .Name("EncountersArchive") .HtmlAttributes(new { style = "height:310px;", id = "AddAReason" }) .Encode(true) .Tools( tools => tools .Clear() .Bold().Italic().Underline().Strikethrough().Subscript().Superscript().Separator() .FontName().FontSize() .FontColor().BackColor().Separator() .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull().Separator() .InsertUnorderedList().InsertOrderedList().Separator() .Indent().Outdent().Separator() )) </div> <p style="text-align:center"> <input type="submit" value="Reason" id="AddReasonID" onclick="CloseWindow()"/> </p> </fieldset>}<telerik:GridHyperLinkColumn HeaderText="" UniqueName="CourseDetailsLink" ImageUrl="Images/ClockIcon.png" DataNavigateUrlFields="TrainingItemID" DataNavigateUrlFormatString="CourseDetails.aspx?itemID={0}" DataTextField="TrainingItemID" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="50px" AllowFiltering="false" Groupable="false"></telerik:GridHyperLinkColumn>

<telerik:RadButton ID="btnProcessPayment" runat="server" Text="Process Payment" CssClass="btn-red-strip" Style="float: left;" ButtonType="SkinnedButton" EnableTheming="false" OnClick="btnProcessPayment_Click" Height="48px" Enabled="false" DisabledButtonCssClass="btn-gray-l" HoveredCssClass="btn-red-strip" SingleClick="True" SingleClickText="Processing..." EnableEmbeddedSkins="False" />protected void chkPaymentMsgAck_CheckedChanged(object sender, EventArgs e){ btnProcessPayment.Enabled = chkPaymentMsgAck.Checked;}.btn-red-strip{ background: url("images/btn-drk-red-strip.jpg") repeat-x scroll 0 0 transparent; color: white; display: block; height: 48px; line-height: 48px; padding: 0 10px; cursor: pointer;}.btn-gray-strip{ background: url("images/btn-gray-strip.jpg") repeat-x scroll 0 0 transparent; color: white; display: block; height: 48px; line-height: 48px; padding: 0 10px; cursor: pointer;}I'm trying to set some tree nodes from the client side once the page loads using the code below:
var tree = $find(clientId);
var allTreeNodes = tree.get_allNodes();
However I get the error below when I try to run it in $(document).ready or $(window).ready.
Microsoft JScript runtime error: Unable to get value of the property 'get_allNodes': object is null or undefined.
So basically it doesn't find the tree. I tested it with jQuery using $("#" + clientId).length and it returns 1 so it exists.
The only time it works is in the pageLoad() which I think is an asp.net ajax method. Can someone explain why this is the case?
Thanks, Dave.