Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / Enable Month & Year Selection in MVC igGrid DatePicker

Enable Month & Year Selection in MVC igGrid DatePicker

New Discussion
Kumar G
Kumar G asked on Mar 16, 2018 12:09 PM

Hello Infragistics community,

I’m using an ASP.Net MVC igGrid. I want my grid to have following behavior

I have a date column in the mvc iggrid to select the start date of a company

column.For(x => x.dtDate).Format(“dd-MMM-yyyy”).HeaderText(“Date”).Width(“15%”); //Date

For the column settings I have this code:

cs.ColumnSetting().ColumnKey(“dtDate”).EditorType(ColumnEditorType.DatePicker).Required(true)

This displays a calendar to select the date but it doesn’t have an option to select the month and year. Otherwise it will be difficult to navigate to particular year and month.

How to achieve this in the my MVC grid.

Any assistance would be greatly appreciated, thanks

Sign In to post a reply

Replies

  • 0
    [Infragistics]Tsanna
    [Infragistics]Tsanna answered on Mar 9, 2018 2:36 PM

    Hello Kumar,

    In order to be able to select month and year from the datepicker, you should define the following editor options:

    datepickerOptions: {
                    		changeYear: true,
                        changeMonth: true,
                        }

    In your case you should define datepickerOptions for the MVC wrapper.

    Please let me know if you need further assistance.

    Regards,

    Tsanna

    • 0
      Kumar G
      Kumar G answered on Mar 12, 2018 7:04 AM

      Hi Tsanna,

      Thanks for the reply.

      Could you please provide a sample code for setting the datePickerOptions for MVC Wrapper.

      I am unable to set it.

      Thanks,

      Uday

      • 0
        [Infragistics]Tsanna
        [Infragistics]Tsanna answered on Mar 12, 2018 3:43 PM

        Hello Kumar,

        Here is the piece of code that sets the datepicker options in MVC, for your reference:

        features.Updating().ColumnSettings(cs =>
        			{
        				cs.ColumnSetting().ColumnKey("StartDate").EditorType(ColumnEditorType.DatePicker).Required(true).EditorOptions("datepickerOptions: {changeYear: true, changeMonth: true}");
        			});

      • 0
        Kumar G
        Kumar G answered on Mar 16, 2018 11:55 AM

        Hi Tsanna,

        Is it Possible to specify minDate and maxDate as part of datePickerOptions. How can i specify minDate and maxDate along with change Year and Month functionality.

        Thanks,

        Kumar G

  • 0
    Kumar G
    Kumar G answered on Mar 16, 2018 11:55 AM

    Hi Tsanna,
     Is it Possible to specify minDate and maxDate as part of datePickerOptions.

    • 0
      [Infragistics]Tsanna
      [Infragistics]Tsanna answered on Mar 16, 2018 12:09 PM

      Hello Kumar,

      I believe you can, because datepickerOptions extend the jQuery datepicker options. Please note that our igDatePicker can use all jQuery datepicker options except those for date formatting.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Kumar G
Favorites
0
Replies
6
Created On
Mar 16, 2018
Last Post
7 years, 11 months ago

Suggested Discussions

Created by

Created on

Mar 16, 2018 12:09 PM

Last activity on

Feb 23, 2026 1:23 PM