Click here to Skip to main content
       

JavaScript

 
GeneralRe: Convert HTML to PDF (Client Side) PinmemberJ4amieC18-Dec-12 22:29 
QuestionCan't figure out why the currentSlide goes 0-3-2 Pinmemberjkirkerx16-Dec-12 13:08 
AnswerRe: Can't figure out why the currentSlide goes 0-3-2 Pinmemberjkirkerx17-Dec-12 9:40 
AnswerSo I rewrote the program from scratch, works pretty good now, feel free to build on it Pinmemberjkirkerx19-Dec-12 18:45 
GeneralRe: So I rewrote the program from scratch, works pretty good now, feel free to build on it PinmvpRichard MacCutchan20-Dec-12 0:15 
GeneralRe: So I rewrote the program from scratch, works pretty good now, feel free to build on it Pinmemberjkirkerx20-Dec-12 7:18 
GeneralRe: So I rewrote the program from scratch, works pretty good now, feel free to build on it PinmvpRichard MacCutchan20-Dec-12 7:39 
QuestionJava Script Pinmembermanoj s sherje14-Dec-12 2:05 
QuestionRe: Java Script PinmemberProgramFOX14-Dec-12 2:33 
QuestionRe: Java Script Pinmemberryanb3118-Dec-12 6:06 
AnswerRe: Java Script Pinmembermanoj s sherje19-Dec-12 2:01 
AnswerRe: Java Script Pinmemberryanb3119-Dec-12 2:37 
AnswerRe: Java Script Pinmembervbmike19-Dec-12 5:28 
QuestionUsing datePicker to disable dates already selected PinmemberxnaLearner11-Dec-12 4:39 
hey guys..So I am using datepicker http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerStartEnd.htmlto select start and end dates.I have the controller coded so that if the user attempts to select a date from the calendar (which is already stored for them-from a previous selection) it will not add it to the DB. I also have the weekends blocked out so they cant be used (done using
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerCustomCellRender.html)
 
E.g say the user has previously selected fri 14th and added it to the DB, if they try to make a new record selecting from thur 13th to mon 17th- only thur 13, and mon 17th will be added to the DB. As fri 14th was previously added and 15 and 16th are weekendsone using the following code:
[HttpPost] public ActionResult listHolidays(Holiday holiday, int? PersonId, string HolidayDate, string endDate, string AlreadyExists) 
{ DateTime startDates = Convert.ToDateTime(HolidayDate); 
DateTime endDates = Convert.ToDateTime(endDate); 
 
while (startDates <= endDates)
{
if (startDates.DayOfWeek != DayOfWeek.Saturday && startDates.DayOfWeek != DayOfWeek.Sunday)
{ 
ViewBag.CantDuplicateHolidays = String.IsNullOrEmpty(AlreadyExists) ? "date" : "";
var dates = from d in db.Holidays
where d.HolidayDate == startDates && d.PersonId == PersonId
select d;
 

// <= 0..so if it does not already exist
if (dates.Count() <= 0)
{
Holiday holiday1 = new Holiday();
holiday1.PersonId = PersonId.Value;
holiday1.HolidayDate = startDates;
 

db.Holidays.AddObject(holiday1);
db.SaveChanges();
//say start date is 10. AddDays(1) will make it 11 then return it to startDates in 'startDates' = startdates,
//but doesnt chage the value of startdates = 'startdates'
}
 

}
 

startDates = startDates.AddDays(1);
}
 

return RedirectToAction("Index");
}
---------------
my view
Date.format = 'dd/m/yyy';
$("#HolidayDate").addClass('date-pick');
$("#endDate").addClass('date-pick');
//$('.date-pick').datePicker//({dateFormat: 'dd-mm-yy'}).val();
 

// clickInput: true
 

$(function () {
//3 methods below dont allow user to select weekends
$('.date-pick').datePicker(
{
createButton: false,
renderCallback: function ($td, thisDate, month, year) {
if (thisDate.isWeekend()) {
$td.addClass('weekend');
$td.addClass('disabled');
}
 

}
}
)
 

.bind('click',
function () {
$(this).dpDisplay();
this.blur();
return false;
}
)
 

.bind('dateSelected',
function (e, selectedDate, $td) {
console.log('You selected ' + selectedDate);
}
);
 

// HolidayDate is start date
$('#HolidayDate').bind('dpClosed',
function (e, selectedDates) {
var d = selectedDates[0];
if (d) {
d = new Date(d);
$('#endDate').dpSetStartDate(d.addDays(0).asString());
}
}
);
 

//end date is end date
$('#endDate').bind('dpClosed',
function (e, selectedDates) {
var d = selectedDates[0];
if (d) {
d = new Date(d);
$('#HolidayDate').dpSetEndDate(d.addDays(0).asString());
}
}
);
});
 

can any suggest how to disable a date on the calendar if it is already in the DB
Questionjquery tabslideout plugin and wired behavior PinmemberTridip Bhattacharjee9-Dec-12 22:13 
AnswerRe: jquery tabslideout plugin and wired behavior PinmemberMayor Daily17-Dec-12 5:22 
GeneralRe: jquery tabslideout plugin and wired behavior PinmemberTridip Bhattacharjee18-Dec-12 1:55 
QuestionNeed help understanding binding PinmemberSteve Bondy7-Dec-12 15:00 
QuestionText replace Pinmemberrakeshs3127-Dec-12 0:06 
AnswerRe: Text replace PinmvpRichard MacCutchan7-Dec-12 1:43 
GeneralRe: Text replace Pinmemberrakeshs3129-Dec-12 6:40 
QuestionJQuery datePicker SelectMultiple format dd/mm/yy PinmemberxnaLearner6-Dec-12 1:37 
AnswerRe: JQuery datePicker SelectMultiple format dd/mm/yy Pinmembersrinivas nv6-Dec-12 22:50 
GeneralRe: JQuery datePicker SelectMultiple format dd/mm/yy PinmemberxnaLearner10-Dec-12 1:04 
QuestionDelete selected rows by table id using javascript PinmemberMember 88023075-Dec-12 9:05 
AnswerRe: Delete selected rows by table id using javascript PinmemberDeepak Kr15-Dec-12 19:45 
GeneralRe: Delete selected rows by table id using javascript PinmemberMember 88023076-Dec-12 7:20 
AnswerRe: Delete selected rows by table id using javascript PinmemberGraham Breach6-Dec-12 22:41 
QuestionHTML5 Javascript Issue [modified] PinmvpJohn Simmons / outlaw programmer3-Dec-12 2:09 
AnswerRe: HTML5 Javascript Issue PinmemberGraham Breach3-Dec-12 6:00 
GeneralRe: HTML5 Javascript Issue PinmvpJohn Simmons / outlaw programmer3-Dec-12 6:22 
GeneralRe: HTML5 Javascript Issue PinmemberGraham Breach3-Dec-12 7:29 
GeneralRe: HTML5 Javascript Issue PinmvpJohn Simmons / outlaw programmer3-Dec-12 7:40 
GeneralRe: HTML5 Javascript Issue PinmemberGraham Breach3-Dec-12 7:48 
GeneralRe: HTML5 Javascript Issue PinmvpJohn Simmons / outlaw programmer3-Dec-12 10:09 
GeneralRe: HTML5 Javascript Issue PinmemberGraham Breach3-Dec-12 12:02 
GeneralRe: HTML5 Javascript Issue PinmvpJohn Simmons / outlaw programmer3-Dec-12 16:20 
GeneralRe: HTML5 Javascript Issue PinmemberMedia2r18-Dec-12 1:51 
GeneralRe: HTML5 Javascript Issue PinmemberBrainiacV18-Dec-12 4:46 
GeneralRe: HTML5 Javascript Issue PinmvpJohn Simmons / outlaw programmer3-Dec-12 6:29 
GeneralRe: HTML5 Javascript Issue PinmvpJohn Simmons / outlaw programmer4-Dec-12 2:06 
GeneralRe: HTML5 Javascript Issue PinmvpJohn Simmons / outlaw programmer4-Dec-12 8:31 
GeneralRe: HTML5 Javascript Issue PinmemberZaf Khan19-Dec-12 21:36 
AnswerRe: HTML5 Javascript Issue PinmemberZaf Khan19-Dec-12 21:42 
QuestionCatching Exceptions in Javascript PinmemberVed Yo29-Nov-12 15:43 
QuestionPartial Overlay to cover ajax request PinmemberSentenryu29-Nov-12 2:51 
QuestionHow to get value from TD PinmemberChitttapa26-Nov-12 11:03 
Questionhelp me please Pinmemberdoa'a_9224-Nov-12 5:16 
AnswerRe: help me please [modified] PinmemberLeon Munir25-Nov-12 14:46 
GeneralRe: help me please PinmemberJ4amieC25-Nov-12 22:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 23 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid