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.
Calling javascript function from button hides FullCalendar in my ASP.net
-
01-07-2023 - |
Question
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.
Solution
OTHER TIPS
Use a HTML input button
<input type="button" id="btnSave" runat="server" Value="save" onclick="save()" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow