views:

42

answers:

1

Hello friends,

I have two fileds in my View one is Effective data and one is Cancle date

 <td>
                Effective date:
            </td>
            <td>
                <%= Html.TextBoxFor( x => Model.SelectedAccountGroup.GroupEffectiveDate, new { @class="datepicker"} )%>
                <%= Html.ValidationMessageFor( x => x.SelectedAccountGroup.GroupEffectiveDate )%>
            </td>
        </tr>
        <tr>
            <td>
                Cancel date:
            </td>
            <td>
                <%= Html.TextBoxFor( x => Model.SelectedAccountGroup.GroupCancelDate, new { @class = "datepicker" } )%>
                <%= Html.ValidationMessageFor( x => x.SelectedAccountGroup.GroupCancelDate )%>
            </td>

On Save button I should not allow user to Enter the Cancle date Before Effective data? can any body tell me how to do this? Thanks

+1  A: 

get the two date field value as a single integer value . For eg 20101006 .

if time is also there add that too,

if you use jquery

var dateval= $("#dateid").val();

for javascript

var dateval = document.getElementById("dateid").value;

I assume the text box where you show date is having an id. let it be dateid

Now you can compare two fields just as integer.

if(date1>date2)

do something

return false

zod
Thanks but how to get those two date field values that is my question? Thanks
kumar
cant you get the values now also??
zod
Hmm Now I am good I am getting the values perfectly.. Thanks
kumar
mark it that as answer. let me cross the 100
zod