asp.net mvc 3 - Clear values in Razor MVC EditorTemplate -


i want create date, time , datetime editortemplate using mvc3 , razor.

for now, let's focus on time (i can fix remaining templates later).

@model datetime?  @using mymvcapp.properties  @html.dropdownlistfor(model => model.value.hour, new selectlist(new[] {"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" },     model.hasvalue ? model.value.hour.tostring("d2") : "00"), null, new { style = "width: auto; margin-left: 5px;" }) : @{     list<string> availableminutes = new list<string>();     (int minute = 0; minute < 60; minute += 1)     {         availableminutes.add(minute.tostring("d2"));     }      @html.dropdownlistfor(model => model.value.minute, new selectlist(availableminutes, model.hasvalue? model.value.minute.tostring("d2") : "00"), null, new { style = "width: auto" }); }   <img alt="@resources.selecttime" src="../../../images/icon_clock_2.gif" style="margin-right: 5px" />  <input id="cleardate" type="button" value="@resources.clear" class="ui-state-default" /> 

the point is: how clear values of editor template only? can add script clears values of id's, editortemplates of same type cleared.

so question: how can clear values (hour , minute) of template when cleardate button clicked?

thanks in advance!

you wrap entire template in div container , walk dom jquery in context cleardate button. i'm doing memory, like:

$(this).parent().children().contents().find("#hourelement").val(""); 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -