Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
865
Set value to datepicker editor provider
posted

Hi All,

I am adding a row to webdatagrid like this

var editing = grid.get_behaviors().get_editingCore();

var rowAdding = editing.get_behaviors().get_rowAdding();

rowAdding._commitRow();

I have a column that have a datepicker editor provider. Now on new row add, I want to set the value of date picker to current date.

I am doing like this:

 $find('ctl00_ContentPlaceHolder1_uwGridIncident_wdDay').value = Date();

I can see the date in the cell but when I am entering the edit mode to that cell, the date pciker is set to blank..

How can I set value of date picker control to that value and make that row editable?

Varun

  • 20255
    Suggested Answer
    Offline posted

    Hello, Thank you for contacting us.

    In order to set the DatePicker value, you should get the cell which is associated to the provider and use set_value method like:

    ig_controls.WebDataGrid1.get_behaviors().get_editingCore().get_behaviors().get_rowAdding().get_row().get_cellByColumnKey("Date").set_value(new Date())

    I have attached a sample that is showing exactly this approach.

    Let me know if I may be of further assistance.

    DDPExample.zip