In the server-side, the "FindControl" function is always returning null.
In the client-side, I always run into this error: "Mircorsoft JScript runtime error: Sys.Extended.UI.TabPanel.prototype is null or not an object. " Research states to set the combinescripts property of the ajaxtoolkit to false, which I did.
Also, the line Sys.Extended.UI.TabPanel is all black on my page, unlike some the samples I've seen is blue. Maybe this is a clue.
I'm using VS 2010, .Net Framework 4.5, AjaxControlToolkit.Binary.NET4.
@valuja: Thanks for your reply. Sorry, what I posted initially was just a snippet of the whole code. I left out that part but was actually in the code.
@krutovdl: I have both VS2010 and VS 2012 on my machine. For some reason, because of connection to TFS, VS 2012 is harder to get around so I'm just using VS2010. When I click on the Help->About-> it says Microsoft .NET Framework, Ver 4.5 SP1Rel
Member
48 Points
291 Posts
Scripts could not see control ToolkitScriptManager
Jan 16, 2014 02:20 PM|tinac99|LINK
Hi,
My server-side scripts and client-side scripts are unable to see the object ToolkitScriptManager ID="ScriptManager1".
Please see my code below:
Server-side:
if (this.Page.FindControl("ScriptManager1") != null)
{
((ScriptManager)this.Page.FindControl("ScriptManager1")).RegisterPostBackControl(btn);
}
Client-Side:
<asp:ToolkitScriptManager ID="ScriptManager1" runat="server" CombineScripts="false" EnablePartialRendering="true" LoadScriptsBeforeUI="true" >
</asp:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<asp:Panel ID="Panel3" runat="server" Visible="false">
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:TabContainer ID="TabContainer1" runat="server" CssClass="Tab" OnActiveTabChanged="TabContainer1_OnActiveTabChanged" AutoPostBack="true" >
<asp:TabPanel runat="server" ID="TabPanel1" HeaderText=" Page1 ">
<ContentTemplate>
<asp:Panel ID="Panel4" runat="server" ScrollBars="Vertical" Height="500px" >
<uc1:ucPageA ID="ucPage1" runat="server" />
</asp:Panel>
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel runat="server" ID="TabPanel2" HeaderText="Page2" BackColor="#99CCFF" >
<ContentTemplate>
<asp:Panel ID="Panel5" runat="server" ScrollBars="Vertical" Height="500px" >
<asp:HiddenField ID="HiddenField3" runat="server" />
<uc2:ucPageB ID="ucPage2" runat="server" Visible="false" />
</asp:Panel>
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel runat="server" ID="TabPanel3" HeaderText="Page3" >
<ContentTemplate>
<asp:Panel ID="Panel6" runat="server" ScrollBars="Vertical" Height="500px">
<asp:HiddenField ID="HiddenField4" runat="server"/>
<uc2:ucPage2 ID="UcPage3" runat="server" Visible="false" />
</asp:Panel>
</asp:TabContainer>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<script type="text/javascript">
Sys.Extended.UI.TabPanel.prototype._header_onclick =function(e) {
if (confirm("Yes?")) {
this.raiseClick();
this.get_owner().set_activeTab(this);}
};
</script>
In the server-side, the "FindControl" function is always returning null.
In the client-side, I always run into this error: "Mircorsoft JScript runtime error: Sys.Extended.UI.TabPanel.prototype is null or not an object. " Research states to set the combinescripts property of the ajaxtoolkit to false, which I did.
Also, the line Sys.Extended.UI.TabPanel is all black on my page, unlike some the samples I've seen is blue. Maybe this is a clue.
I'm using VS 2010, .Net Framework 4.5, AjaxControlToolkit.Binary.NET4.
Please advise.
Thanks,
tinac99
Member
44 Points
73 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 16, 2014 03:49 PM|krutovdl|LINK
The client-side scripts must be regeistered in the ToolkitScriptmanager. Try like in the example below:
Member
48 Points
291 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 16, 2014 04:52 PM|tinac99|LINK
Thanks for the reply krutovdl. I still had the same error.
Member
44 Points
73 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 16, 2014 05:24 PM|krutovdl|LINK
Member
48 Points
291 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 16, 2014 09:14 PM|tinac99|LINK
Yes.
Member
44 Points
73 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 16, 2014 09:25 PM|krutovdl|LINK
I noticed you are using VS2010 with 4.5 framework. VS2010 is 4.0 framework or lower.
All-Star
48393 Points
12161 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 16, 2014 11:07 PM|chetan.sarode|LINK
Try this
((ToolkitScriptManager)this.Page.FindControl("ScriptManager1")).RegisterPostBackControl(btn);
Or AjaxControlToolkit.ToolkitScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(btn);
Team Lead, Product Development
Approva Systems Pvt Ltd, Pune, India.
Participant
1390 Points
323 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 17, 2014 03:34 AM|valuja|LINK
Hi,
In the code that you have provided the TabPanel3 is missing the following:
maybe that is the problem?
Best regards
Johan
Member
48 Points
291 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 17, 2014 12:26 PM|tinac99|LINK
@valuja: Thanks for your reply. Sorry, what I posted initially was just a snippet of the whole code. I left out that part but was actually in the code.
Member
48 Points
291 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 17, 2014 12:30 PM|tinac99|LINK
@krutovdl: I have both VS2010 and VS 2012 on my machine. For some reason, because of connection to TFS, VS 2012 is harder to get around so I'm just using VS2010. When I click on the Help->About-> it says Microsoft .NET Framework, Ver 4.5 SP1Rel
Member
48 Points
291 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 17, 2014 12:59 PM|tinac99|LINK
this is rewrite in response to krutovdl's reply:
<asp:ToolkitScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" CombineScripts="false" LoadScriptsBeforeUI="true" >
<Scripts>
<asp:ScriptReference NotifyScriptLoaded="false" ScriptMode="Auto" Path="js/tabBehavior.js" />
</Scripts>
</asp:ToolkitScriptManager>
tabBehavior.js
document.write("hello1");
Sys.Extended.UI.TabPanel.prototype.header_onclick =function(e) {
document.write("hello2");
this.raiseClick();
if (isValidated()) {
// add this additional code line to do validation
document.write("hello6 - isValidated()");
this.get_owner().set_activeTab(this);
}
};
function isValidated() {
document.write("hello3 - validated");
return false;
}
On the initial load of the page, on debug mode, it displays: Sys.Extended.UI is null or not an object. When I switch tabs, it always "hello1".
Member
44 Points
73 Posts
Re: Scripts could not see control ToolkitScriptManager
Jan 17, 2014 01:24 PM|krutovdl|LINK
Try chaging
to something like:
Basically provide a full path to the js file.