i haven't found a solution for my problem. I am using asp.net mvc. In my View I am trying to call a Method, on a Buttonclick. This is how the button looks like at the moment

 <button type="button" id="@openButtonID" data-loading-text=" öffnen..." class="btn btn-primary" autocomplete="off" onclick="location.href='@Url.Action("Open", "Home", new {index =i} )'" disabled="@notConnected">

So everytime I am clicking the button the website reloades itself. At the website there is a camaera stream which disappears for some seconds during the refresh. Now i have the task to avoid this, so the stream can been seen during the whole time. I have tried to call the method via Razor like this:

<button type="button" id="@openButtonID" data-loading-text=" öffnen..." class="btn btn-primary" autocomplete="off" onclick="@{( (GateControl.Controllers.HomeController)this.ViewContext.Controller ).Open( i );}" disabled="@notConnected">

But this jus calls the Method if the view is loaded. As I tried this I set the return of the method to void. Also I tried it like it is described like in this. Either the website is reloaded or i wasn't able to get in the method. I also tried several code snippets from stack overflow, but it wasn't working.

This is how the Method looks like

[CustomAuthorize]
    public void Open( int index )
    {

        //some code

    }

Thanks for your help.

Related posts

Recent Viewed