Solved

asp.net calendar and database

Posted on 2014-02-27
6
675 Views
Last Modified: 2014-03-17
1. when the page is onload, i want to automatically show the current month and next month calender. Is it possible to do that?

2. Inside of the calendar, I would like to show some data and the data comes from the sql server. How to do that? like it will be select checkout car from cars where date = 01/01/2014. so 01/01/2014 in the calender will show the car name and etc.

3. Inside of the calender, I would like to block some date ranges and  the data domes from sql database server as well. is it possible?
0
Comment
Question by:CoolDev2014
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39893824
I don't know how to do this specifically on .net.  I do use fullcalendar http://arshaw.com/fullcalendar/

<link rel='stylesheet' type='text/css' href='fullcalendar.css' />
<script type='text/javascript' src='jquery.js'></script>
<script type='text/javascript' src='fullcalendar.js'></script>
$(document).ready(function() {

    // page is now ready, initialize the calendar...

    $('#calendar').fullCalendar({
        // put your options and callbacks here
    })

});
<div id='calendar'></div>

Open in new window


You simply need to create a json feed via your .net http://arshaw.com/fullcalendar/docs/event_data/Event_Source_Object/

There is a good learning curve and if you understand js/jquery it is easier.  It did take me a few times using to wrap my head around all it offers but it has a lot of great built in features.  It is also free.

Kendo http://demos.telerik.com/kendo-ui/web/calendar/index.html has .NET wrappers but the entire shabang will set you back $1000.
0
 

Author Comment

by:CoolDev2014
ID: 39893918
good free option. But need some experts telling me how to do it xml.
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39894523
You can use an xml fee http://arshaw.com/fullcalendar/docs/event_data/events_function/
$('#calendar').fullCalendar({
    events: function(start, end, callback) {
        $.ajax({
            url: 'myxmlfeed.php',
            dataType: 'xml',
            data: {
                // our hypothetical feed requires UNIX timestamps
                start: Math.round(start.getTime() / 1000),
                end: Math.round(end.getTime() / 1000)
            },
            success: function(doc) {
                var events = [];
                $(doc).find('event').each(function() {
                    events.push({
                        title: $(this).attr('title'),
                        start: $(this).attr('start') // will be parsed
                    });
                });
                callback(events);
            }
        });
    }
});

Open in new window


If you want to select a day or event such http://arshaw.com/fullcalendar/docs/mouse/
$('#calendar').fullCalendar({
    dayClick: function(date, allDay, jsEvent, view) {

        if (allDay) {
            alert('Clicked on the entire day: ' + date);
        }else{
            alert('Clicked on the slot: ' + date);
        }

        alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);

        alert('Current view: ' + view.name);

        // change the day's background color just for fun
        $(this).css('background-color', 'red');

    }
});

Open in new window

This gives the similar look and fee of google calendar except you are using your own data source that you control.
0
Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

 

Author Comment

by:CoolDev2014
ID: 39895893
thank. assume i built a web service and serving soap with xml. How to parse there in js?
I need some example. Thanks
0
 

Author Comment

by:CoolDev2014
ID: 39898797
with asp.net/c# please.
0
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39899172
ASP runs on the server, javascript/jquery run on the client so the two do not meet.

On line 4 http:#a39894523 you just need to switch out the url with your own url

Lines 8 & 9 are the data you are sending.  The end result is the same as myxmlfeed.php?start=1393799271&end= 1393885664000.  You can send the date time in any format you want, the sample is in unix time.  However, your date/time you send back needs to be in unix time. If that is not possible, you can convert it on line 16 using javascript http://www.epochconverter.com/programming/
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
history of pages 7 53
Submitting form with no refresh at the end 2 32
Natural height and jquery 6 40
Drag & Drop Error 5 32
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question