Click here to Skip to main content
16,004,977 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Crud operation by pattern Pin
Nathan Minier1-Nov-16 2:12
professionalNathan Minier1-Nov-16 2:12 
AnswerRe: Crud operation by pattern Pin
F-ES Sitecore1-Nov-16 5:46
professionalF-ES Sitecore1-Nov-16 5:46 
QuestionSave Foreign Key Value - EF Core + ASP.NET Core Pin
vanilsonwdd31-Oct-16 19:43
vanilsonwdd31-Oct-16 19:43 
QuestionOptimal way to share data between MVC Controller and AngularJS Pin
L_Q31-Oct-16 10:50
L_Q31-Oct-16 10:50 
AnswerRe: Optimal way to share data between MVC Controller and AngularJS Pin
Nathan Minier1-Nov-16 2:25
professionalNathan Minier1-Nov-16 2:25 
GeneralRe: Optimal way to share data between MVC Controller and AngularJS Pin
L_Q1-Nov-16 2:42
L_Q1-Nov-16 2:42 
GeneralRe: Optimal way to share data between MVC Controller and AngularJS Pin
Nathan Minier1-Nov-16 3:11
professionalNathan Minier1-Nov-16 3:11 
QuestionMultiple Date Rages in Multi select Drop down list in HTML 5 using JQuery or AngularJS Pin
indian14331-Oct-16 6:25
indian14331-Oct-16 6:25 
Hi All,

I have to have date ranges selected multiple times in HTML5, Like for example if we have Start Date and End Date, like this, there should be multiple Start and End Dates Selected, if one Start and End Date is Selected, then the drop down (or that element) should allow me to select another one as long as I want one.

Any help would be appreciated thanks in advance my friends.

Here is my code to display one set of Date pickers for start and end:
        var template;
        if (paramType === 'Date Range') {
            var multiple = "multiple='multiple'";
            template =
            '<div id="Param_' + Id + '">' +
                '<div class="parameterHeader ui-widget-header ui-corner-top">' + paramDisplayName + '</div>' +
                '<div class="parameterItem ui-widget-content ui-corner-bottom" ' + multiple + '>' +
                    '<div class="parameterFieldResize parameterField">' +
                        '<input class="parameterDateRangePicker clearable" placeholder="Start" type="text" name="' + paramName + '_1_Start" id="' + paramName + '_1_Start" />' +
                        '<input class="parameterDateRangePicker clearable" placeholder="End" type="text" name="' + paramName + '_1_End" id="' + paramName + '_1_End" />' +
                    '</div>' +<br />
                '</div>' +
            '</div>';

<pre>
        //Insert HTML
        this.JQElem = $(template);
        initialParent.append(this.JQElem);            

        $('#' + paramName + '_1_Start').datepicker({
            onSelect: function (dateText) {
                $(this).trigger("input");
                if (typeof me.values[this.id.split('_')[1]] === 'undefined')
                    me.values[this.id.split('_')[1]] = {};
                me.values[this.id.split('_')[1]]['Start'] = dateText;
            }
        });
        $('#' + paramName + '_1_End').datepicker({
            onSelect: function (dateText) {
                $(this).trigger("input");
                if (typeof me.values[this.id.split('_')[1]] === 'undefined')
                    me.values[this.id.split('_')[1]] = {};
                me.values[this.id.split('_')[1]]['End'] = dateText;
            }
        });
        $("#" + paramName + '_1_Start').change(function (event) {
            //convert to 4 digit year (always will be in the 20's)
            var dateString = this.value;
            if (/^\d{1,2}\/\d{1,2}\/\d{2}$/.test(dateString)) {
                dateString = dateString.substring(0, dateString.length - 2) + '20' + dateString.substring(dateString.length - 2, dateString.length);
                this.value = dateString;
            }
            if (isValidDate(dateString)) {
                if (typeof me.values[paramName + '_1'] === 'undefined')
                    me.values[this.id.split('_')[1]] = {};
                me.values[this.id.split('_')[1]]['Start'] = dateString;
            } else if (typeof me.values[this.id.split('_')[1]] !== 'undefined' && typeof me.values[this.id.split('_')[1]]['Start'] !== 'undefined') {
                if (typeof me.values[this.id.split('_')[1]]['End'] !== 'undefined')
                    delete me.values[this.id.split('_')[1]];
                else
                    delete me.values[this.id.split('_')[1]];
            }
        });
        $("#" + paramName + '_1_End').change(function (event) {
            //convert to 4 digit year (always will be in the 20's)
            var dateString = this.value;
            if (/^\d{1,2}\/\d{1,2}\/\d{2}$/.test(dateString)) {
                dateString = dateString.substring(0, dateString.length - 2) + '20' + dateString.substring(dateString.length - 2, dateString.length);
                this.value = dateString;
            }
            if (isValidDate(dateString)) {
                if (typeof me.values[this.id.split('_')[1]] === 'undefined')
                    me.values[this.id.split('_')[1]] = {};
                me.values[this.id.split('_')[1]]['End'] = dateString;
            } else if (typeof me.values[this.id.split('_')[1]] !== 'undefined' && typeof me.values[this.id.split('_')[1]]['End'] !== 'undefined')
                if (typeof me.values[this.id.split('_')[1]]['End'] !== 'undefined')                        
                    delete me.values[this.id.split('_')[1]];
                else
                    delete me.values[this.id.split('_')[1]];
        });

The same thing was possible for Multi select Dropdown, here is the code for that, but when I am trying to do the same on the Date pickers its not working, any Idea is going to be greatly helpful, a code snippet, a link or even suggestion is going to be very helpful thanks in advance my friends.

var template;
if (paramType === 'Date Range') {
var multiple = "multiple='multiple'";
template =
'
' +
'
' + paramDisplayName + '
' +
'
' +
'
' +
'<input class="parameterDateRangePicker clearable" placeholder="Start" type="text" name="' + paramName + '_1_Start" id="' + paramName + '_1_Start" />' +
'<input class="parameterDateRangePicker clearable" placeholder="End" type="text" name="' + paramName + '_1_End" id="' + paramName + '_1_End" />' +
'
' +

'
' +
'
';

//Insert HTML
this.JQElem = $(template);
initialParent.append(this.JQElem);

$('#' + paramName + '_1_Start').datepicker({
onSelect: function (dateText) {
$(this).trigger("input");
if (typeof me.values[this.id.split('_')[1]] === 'undefined')
me.values[this.id.split('_')[1]] = {};
me.values[this.id.split('_')[1]]['Start'] = dateText;
}
});
$('#' + paramName + '_1_End').datepicker({
onSelect: function (dateText) {
$(this).trigger("input");
if (typeof me.values[this.id.split('_')[1]] === 'undefined')
me.values[this.id.split('_')[1]] = {};
me.values[this.id.split('_')[1]]['End'] = dateText;
}
});
$("#" + paramName + '_1_Start').change(function (event) {
//convert to 4 digit year (always will be in the 20's)
var dateString = this.value;
if (/^\d{1,2}\/\d{1,2}\/\d{2}$/.test(dateString)) {
dateString = dateString.substring(0, dateString.length - 2) + '20' + dateString.substring(dateString.length - 2, dateString.length);
this.value = dateString;
}
if (isValidDate(dateString)) {
if (typeof me.values[paramName + '_1'] === 'undefined')
me.values[this.id.split('_')[1]] = {};
me.values[this.id.split('_')[1]]['Start'] = dateString;
} else if (typeof me.values[this.id.split('_')[1]] !== 'undefined' && typeof me.values[this.id.split('_')[1]]['Start'] !== 'undefined') {
if (typeof me.values[this.id.split('_')[1]]['End'] !== 'undefined')
delete me.values[this.id.split('_')[1]];
else
delete me.values[this.id.split('_')[1]];
}
});
$("#" + paramName + '_1_End').change(function (event) {
//convert to 4 digit year (always will be in the 20's)
var dateString = this.value;
if (/^\d{1,2}\/\d{1,2}\/\d{2}$/.test(dateString)) {
dateString = dateString.substring(0, dateString.length - 2) + '20' + dateString.substring(dateString.length - 2, dateString.length);
this.value = dateString;
}
if (isValidDate(dateString)) {
if (typeof me.values[this.id.split('_')[1]] === 'undefined')
me.values[this.id.split('_')[1]] = {};
me.values[this.id.split('_')[1]]['End'] = dateString;
} else if (typeof me.values[this.id.split('_')[1]] !== 'undefined' && typeof me.values[this.id.split('_')[1]]['End'] !== 'undefined')
if (typeof me.values[this.id.split('_')[1]]['End'] !== 'undefined')
delete me.values[this.id.split('_')[1]];
else
delete me.values[this.id.split('_')[1]];
});

Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."


modified 31-Oct-16 16:02pm.

QuestionFull crud operation in ASP.NET in a single page with dropdownlist, radio button and checkbox controls Pin
Member 1273685631-Oct-16 1:26
Member 1273685631-Oct-16 1:26 
GeneralRe: Full crud operation in ASP.NET in a single page with dropdownlist, radio button and checkbox controls Pin
Richard MacCutchan31-Oct-16 1:41
mveRichard MacCutchan31-Oct-16 1:41 
AnswerRe: Full crud operation in ASP.NET in a single page with dropdownlist, radio button and checkbox controls Pin
ZurdoDev31-Oct-16 1:54
professionalZurdoDev31-Oct-16 1:54 
QuestionView to Controller - HTML form POST action failing, with wrong Requested URL Pin
Member 1282452930-Oct-16 21:27
Member 1282452930-Oct-16 21:27 
AnswerRe: View to Controller - HTML form POST action failing, with wrong Requested URL Pin
Richard Deeming31-Oct-16 4:10
mveRichard Deeming31-Oct-16 4:10 
QuestionHow to show/hide textboxes based on what is selected via toggle switch Pin
Bootzilla3328-Oct-16 6:37
Bootzilla3328-Oct-16 6:37 
AnswerRe: How to show/hide textboxes based on what is selected via toggle switch Pin
Richard Deeming28-Oct-16 7:12
mveRichard Deeming28-Oct-16 7:12 
QuestionHow do I insert a toggle switch value into sql database Pin
Bootzilla3326-Oct-16 19:07
Bootzilla3326-Oct-16 19:07 
AnswerRe: How do I insert a toggle switch value into sql database Pin
Richard Deeming27-Oct-16 2:15
mveRichard Deeming27-Oct-16 2:15 
QuestionHow to submit a record and send as an email attachment at once? Pin
samflex26-Oct-16 9:43
samflex26-Oct-16 9:43 
AnswerRe: How to submit a record and send as an email attachment at once? Pin
ZurdoDev26-Oct-16 9:49
professionalZurdoDev26-Oct-16 9:49 
GeneralRe: How to submit a record and send as an email attachment at once? Pin
samflex26-Oct-16 10:34
samflex26-Oct-16 10:34 
AnswerRe: How to submit a record and send as an email attachment at once? Pin
ZurdoDev26-Oct-16 11:49
professionalZurdoDev26-Oct-16 11:49 
GeneralRe: How to submit a record and send as an email attachment at once? Pin
samflex26-Oct-16 15:32
samflex26-Oct-16 15:32 
GeneralRe: How to submit a record and send as an email attachment at once? Pin
ZurdoDev26-Oct-16 15:42
professionalZurdoDev26-Oct-16 15:42 
AnswerRe: How to submit a record and send as an email attachment at once? Pin
jkirkerx26-Oct-16 13:33
professionaljkirkerx26-Oct-16 13:33 
GeneralRe: How to submit a record and send as an email attachment at once? Pin
samflex26-Oct-16 15:41
samflex26-Oct-16 15:41 

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

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