We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

New Row with pre determined date

Thread ID:

Created:

Updated:

Platform:

Replies:

115920 Feb 25,2014 03:06 PM Mar 6,2014 01:40 AM ASP.NET MVC (Classic) 3
loading
Tags: Grid
Steven Sinakhot
Asked On February 25, 2014 03:06 PM

Hello,

I have a grid that uses InlineTemplateForm with JSON.
Here is my templateform 
@model ICD9Model
<fieldset>
    <b>ICD9 Details</b>
    @Html.TextBoxFor(model => model.ID, new { style = "display:none" }) 
    <table class="table-container">
        <tr>
            <td>
                <table class="content-left">
                    <tr>
                        <td>
                            Date
                        </td>
                        <td>
                            @Html.TextBoxFor(model => model.Date)
                            @Html.ValidationMessageFor(model => model.Date)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Diagnosis <a rel='nofollow' href="javascript:void(0)" onclick="SearchOpen();">(Select ICD9)</a>
                        </td>
                        <td id="icd9_details_diagnosis">
                            @Html.TextBoxFor(model => model.Diagnosis) 
                            @Html.ValidationMessageFor(model => model.Diagnosis)
                        </td>
                    </tr>
                </table>
            </td>
    </table>
</fieldset>


Is there a way I can specify the Date to be Today's date when the user clicks on Add New Item?


Shanmugaraja K [Syncfusion]
Replied On February 28, 2014 03:42 AM

Hi Steven Sinakhot,

 

Thanks for using Syncfusion products.

 

We would like to let you know that your requirement has beed achieved by handling OnActionSuccess client side event. Please refer the below code snippet to achieve your requirement.

 

[JS]

 

<script type="text/javascript">

    function success(sender, args)

    {

        if (args.RequestType == "AddNew")

        {

            $("#GenericListGriddate").val($.datepicker.formatDate("yy-mm-dd", new Date()));

        }

       

    }

</script>

 

Please refer the below attached sample for further reference.

 

Please let us know if you need further reference.

 

Regards,

Shanmugaraja K


Attachment: templateform_dc676572.zip

Steven Sinakhot
Replied On March 5, 2014 01:41 PM

It works perfectly. Thank you.

Shanmugaraja K [Syncfusion]
Replied On March 6, 2014 01:40 AM

Hi Steven,

Thanks for your update.

We will wait to hear from you.

Please let us know if you need further assistance.

Regards,
Shanmugaraja K

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;