Pregunta

I have an C# ASP.net website that is using FullCalendar (http://arshaw.com/fullcalendar/).

I want to grab all the calendar events and save them to my SQL database. I have added the following button which calls a javascript function:

<script type="text/javascript">

        function save() {
        alert('save');
        //this will save to database...
    }
</script>

 <asp:Button ID="btnSave" runat="server"  OnClientClick=" return save();" Text="Save" />

I notice that when I click the button the message appears but then the whole calendar just disappears from my page, why is this? and how can I prevent it.

¿Fue útil?

Solución

It sounds like you're wanting to keep the page from submitting with this button. Adding return false; to your save() function will prevent the postback from occurring. If that is not right and you have a server-side click event for this button, in it, you will need to emit the javascript needed to recreate the calendar.

Otros consejos

Use a HTML input button

<input type="button" id="btnSave" runat="server" Value="save" onclick="save()" />

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top