In the following sample code i have defined the Method “SwitchNB” which should show or hide the NavigationBar:
public partial class Startseite : Page
{
public Startseite()
{
InitializeComponent();
}
//—————————–
// Publish WebMethods
//————————–—
protected override void OnWebRender(dynamic config)
{
base.OnWebRender((object)config);
config.webMethods = new[] { “SwitchNB” };
RegisterWebMethods(config);
}
//——————————–
// NavigationBar ON/OFF
//——————————–
[WebMethod]
public void SwitchNB()
{
navigationBar1.Visible = !navigationBar1.Visible;
}
In my HTML-Code i have defined a Button which is calling the Javascript “callwise()”:
<script type=”text/javascript”>
function callwise()
{
App.Startseite.SwitchNB();
}
</script>
When I’m pressing the button I will get the following Error Mesaage in the Browser console window: (Browser1.png)
Uncaught ReferenceError: App is not defined
When I’m inserting tha call manually in the console window the call is working: (Browser2.png)
What am I doing wrong ????
Hi Alaa,
i seems that I have found the problem. The Html-Page i’m using for testing is included in an iFramepanel, when i change the container to an Htmlpanel its’ working.
Is it not possible to access from a html code, which is included in an iFramepanel, to reach the App Object ?
The button link is calling directly the javascript href=”javascript:App.Startseite.SwitchNB();”
Manfred
Hello Manfred,
Would you be able to wrap a sample to check exactly what you’re trying to achieve?
Also, some additional info is required:
TIA,
Alaa
//
Please login first to submit.