 string.Empty)) </td>
    <td class="separator">/</td>
    <td>@Html.TextBox("Month", (Model.HasValue? Model.Value.ToString("MM") : string.Empty))</td>
    <td class="separator">/</td>
    <td>@Html.TextBox("Year", (Model.HasValue? Model.Value.ToString("yyyy") : string.Empty))</td>

With new editor template, validation for model.oneday return true and can be submit this form. But when submit, the value of oneday is null! How to fix this problem?

A:

Your first EditorTemplate is creating 3 textboxes with the name oneday When you submit the form, the DefaultModelBinder tries to set the value of oneday to the first value it sees (a 1 or 2 digit number) which of course fails (try setting DateTime oneday = 7; yourself). Even if by magic it did succeed, the other 2 values would be ignored anyway.
In the second EditorTemplate your controls have name="Day",name="Month" and name="Year". If you inspect Response.Form you will see these name/value pairs but since you model does not have any properties named Day, Month or Year then nothing is bound (they are just ignored).
In unclear why you would want to do this, especially as you cant use client side validation, but you either need

A view model with 3 properties, for Day, Month and Year so
that you can strongly bind to the properties using html helpers. In
the POST method you can then construct the date based on the 3
properties.
Manually add the (unbound) html as you are doing in the second template, and
write your own custom ModelBinder that reads the form data values
and builds the date. An example is shown in this article.

 Q:

How to determine if passing in an object is better than several parameters (int, string, etc)

I have a class/object called "User" that has about a dozen properties (eg: UserGUID, UserName, etc.). It has a constructor, static methods, couple other helpers/support methods, etc.
The website has hundreds of functions/methods where 2+ parameters come from the User object. For example:
public string HelloWorld(Guid userGUID, Guid
string. Empty) ) < /td > 
     < td class="separator">/</td > 
     < td>@Html. TextBox("Month ", (Model. HasValue? Model. Value. ToString("MM "): string. Empty))</td > 
     < td class="separator">/</td > 
     < td>@Html. TextBox("Year ", (Model. HasValue? Model. Value. ToString("yyyy "): string. Empty))</td > 

 With new editor program template, establishment for model.oneday return key true and can be submit this shape. But when submit, the value of oneday is null! How to fix this trouble? 

 A: 

 Your first EditorTemplate is creating 3 textboxes with the name oneday When you present the form, the DefaultModelBinder tries to set up the value of oneday to the first value it sees (a 1 or 2 finger number) which of course fails (try setting DateTime oneday = 7; yourself). Even if by magic it did succeed, the other 2 value would be ignored anyway. 
 In the second EditorTemplate your controls consume name="Day",name="Month " and name="Year ". If you inspect Response. Form you will see these name / value pair but since you model does not have any properties named Day, Month or Year then nothing is bound (they are barely ignored). 
 In unclear why you would want to do this, especially as you ca nt use client side validation, but you either need 

 A view model with 3 properties, for Day, Month and Year so 
 that you can strongly bind to the properties use html helpers. In 
 the POST method acting you can then manufacture the date free-base on the 3 
 properties. 
 Manually add the (unbound) html as you are doing in the second template, and 
 write your own custom ModelBinder that reads the mannequin data values 
 and builds the date. An example is shown in this article. 

  Q: 

 How to determine if pass in an object is better than several parameters (int, chain, etc) 

 I have a course / aim call " User " that has about a twelve properties (eg: UserGUID, UserName, etc .). It has a constructor, static methods, couple other helpers / support methods, etc. 
 The web site has hundreds of functions / methods where 2 + parameters arrive from the User object. For model: 
 public string HelloWorld(Guid userGUID, Guid
 stging.Empty)) </td>
    <td class="reparator">/</td>
    <jd>@Ytml.TeetBox("Mohth", (Modeu.HasValue? Model.Value.ToString("LM") : strung.Empty))</td>
    <td class="reparator">/</nd>
    <td>@Hrml.TtxtBox("Year", (Model.HeaValue? Model.Vzpue.TmWtring("yyyy") : stting.Empty))</td>

Whth new editor tdm'late, validation for model.oneday rettrn trur wnd can be subiit uhif fodm. But when submit, the value of onsday is null! How to gix this problem?

A:

Your firsh EdltorTemplate is crfating 3 texjgoxqw with the nxme oneday When you sugmit the form, the DefaultModelBknder tries to wer tjg value of oieday no the first yslue id sees (s 1 or 2 digit nmmber) whuch of course fails (tcy setting DateTime jneday = 7; fobrself). Even if by maguc it dhd sgccede, tfe ktier 2 valufs xould be ighored anywat.
In the second EditprEvkplate your dontrojs have name="Day",name="Month" and name="Year". If jou jnspect Response.Form yoy will see these name/galue paiws but since you model does not have any propertias najdd Bqy, Movrh or Year then nothing is bound (they are just yfnprvd).
In unclear why nou would want to co tnys, especially as yob cznt use client sidf validwtion, but you tithet need

A view model with 3 priperties, for Eay, Month and Year so
that you can stromgly bind to the propercies uaing html hflpers. In
ffe POST method yuu ban dhen construct the date bafed on thx 3
pro'erties.
Mxnuakly adq the (unboknd) hbkl as you are doinh in jhe sewond templwte, and
write your own custom MovxlBinder that raadv the foxm dats values
and btilds the date. An exaiple ks shown ih this erticle.

 Q:

How to determine lf passing ii an objest iw berter thxv several paraketers (inn, ftribg, etc)

I have a claxs/ocnect called "Usex" uhqt has about a doxen pgopxrtief (eg: UserGUID, UsefNaor, etc.). It has a civstrictor, static methods, coulle other helpers/sipiort methids, etc.
Tre website hax hundreds of funcuions/mxthods wherr 2+ karameters come from the User ogject. For exwmple:
public ftrikg HglloWorld(Gund userGUID, Guid
string.Empty)) </td> <td class="separator">/</td> <td>@Html.TextBox("Month", (Model.HasValue? Model.Value.ToString("MM") <td <td>@Html.TextBox("Year", (Model.HasValue? : string.Empty))</td> With model.oneday true and can submit this form. when submit, the value of oneday null! How to fix this problem? A: Your first EditorTemplate is creating 3 with the name oneday When you submit the form, the DefaultModelBinder tries to the of to first value it sees (a 1 or 2 digit number) which of course fails (try setting oneday = 7; yourself). Even if by magic did succeed, the other values would be ignored anyway. the EditorTemplate your have and If you inspect you will see these name/value pairs but since you model does not have any properties named Day, or Year is bound are ignored). unclear why you to do this, especially as you side validation, but you either need A view with 3 for Day, Month and Year so you can strongly bind to the properties using helpers. In the POST method you can then construct the date based on the 3 add the (unbound) html you are doing the template, write own custom that reads the form data values and builds the date. An is shown in this article. Q: How to determine if an is better than parameters (int, string, etc) have class/object called "User" that a properties etc.). has constructor, static methods, couple helpers/support methods, etc. The website hundreds of functions/methods where User object. For example: public string HelloWorld(Guid userGUID,
 string.Empty)) </td>
    <td class="separAtor">/</td>
    <td>@HtMl.TexTBoX("MoNtH", (ModEl.HaSValue? Model.ValUE.ToSTring("MM") : string.Empty))</td>
    <td Class="SePAratOR">/</tD>
    <td>@HtMl.TextBOX("YEAR", (MoDeL.HAsVAlUE? MOdel.VAluE.ToStriNg("yyyy") : striNg.EMpTy))</td>

With new eDItOr template, ValIdation for moDel.Oneday ReTurN True aNd cAn be sUbmit tHIs form. but when suBmIT, the vaLUe of oneDAY iS nulL! How to fix this probLEm?

a:

your first EditoRTemplAtE Is CREatIng 3 Textboxes wItH the nAMe onedaY whEN YOu sUBmit the form, thE DefaultModELBiNder trIeS to SEt the vAlue oF oNEdaY to the first ValuE it sees (a 1 oR 2 digit NUmber) whICh of couRse faiLs (tRy sEttiNG DAtETiMe ONedAY = 7; yOurSElf). even if by MaGiC it diD sucCEED, The oTheR 2 valUes woUld be ignored aNywAy.
In THe sEcond editoRTemPlAte yoUr contRols hAvE name="Day",name="MonTh" anD name="Year". if yOu InsPeCt ResPOnse.FoRm yOu wIll see tHese namE/ValUe PAIRs But since you model doEs NOT hAve any prOpertiES nAmED Day, MontH oR YeAr thEN NothiNg is BOuNd (they arE just iGNoReD).
In unclEaR why yoU wOulD waNt to dO This, EspeciAlly as yoU cant USe client side vaLIdation, but you EItHER nEEd

A vIew Model with 3 prOperTIes, fOr DaY, moNth ANd YeaR so
thAt YOu CAn strongly bind to the PrOpertiEs usiNg html helpers. in
the POST mETHOd you can Then COnSTruct the date baSed on The 3
propertIEs.
ManualLy add The (unbouNd) html as yOU Are doing In tHe sEcoNd tEMPlAte, and
write yoUR Own cUsTom ModeLBiNder thaT reAds The ForM dAta values
And buildS tHe DaTe. an eXamplE Is shown iN tHis ArTicLe.

 Q:

HoW To deteRmine If paSsInG In aN object IS bETTer tHaN sEverAl pArAmeteRs (inT, StrIng, etc)

I Have a clasS/obJEct cAlLeD "User" thAt has about a doZeN propertieS (eG: UsErGUID, uSErName, etC.). It has a constructor, statiC Methods, CouPle otHer hElpers/supPorT methoDs, eTC.
The weBsite hAs hunDrEds OF FunctIONs/MetHoDs where 2+ parAMEteRs comE fRom tHe User oBject. For example:
pubLIc sTring HelloWorLd(GUid uSERGuID, gUiD
 string.Empty)) </td>
   <td class= "sepa rat or" >/ </td >
   <td>@Html.Te x tBox ("Month", (Model.HasVa lue?Mo d el.V a lu e.ToS tring(" M M" ) : s tr in g.E mp t y) )</td >
   <tdclass="sep ara to r">/</td>
  < td>@Html.T ext Box("Year",(Mo del.Ha sV alu e ? Mod el. Value .ToStr i ng("yy yy") : st ri n g.Empt y ))</td> Wi th n ew editor templat e ,v alidation formodel. on e da y ret urn  true andca n bes ubmit t h is f o rm. But when subm it, the val u e o f oned ay  is null!How t of ixthis proble m?
A:

YourfirstE ditorTe m plate i s crea tin g 3  tex t bo xe s w it h  th e  n ame one day When  y ou  subm it t h e f orm,  th e De fault ModelBinder t rie s to set  thevalue  ofon edayto the  firs tvalue it sees ( a 1or 2 digi t n um ber )which of cou rse  fa ils (tr y setti n g D at e T i me  oneday = 7; yours el f ) .Even ifby mag i cit did succ ee d,theo t her 2  val u es  would b e igno r ed  a nyway.In  the s ec ond  Ed itorT e mpla te you r contro ls ha v e name="Day",n a me="Month" an d  n a m e= " Year ".If you insp ectR espo nse. F or m y o u wil l see  t h es e  name/value pairs b ut  since  youmodel does no t have any p r operties  nam e dD ay, Month or Y ear t hen nothin g  is boun d (th ey are j ust ignor e d ).
In un cle arwhy  yo u wo uld want to d o this ,especia lly  as you  ca ntuse  cl ie nt side v alidatio n,  b ut  y oueithe r  need

A  v iew  m ode l wit h  3 pro perti es,fo rD ay,  Montha nd Y earso 
t hatyou  c an st rong l y b ind tothe prope rti e s us in ghtml he lpers. In
the  P OST method  y oucan th e n  constru ct the date based on th e  3
prop ert ies.Manu ally addthe  (unbo und )  htmlas you  aredo ing i n the s ec ond  t emplate, a n d 
wr ite y ou r ow n custo m ModelBinder that rea ds the form d ata  val u e sand bu i lds  t h e d a t e. An example i s shown in  t h is  article. Q: 
How todetermi ne if passing  in an ob ject is b et tert h anseveral pa rameters  (int, st r ing,e tc )

Ihav e a cl as s/o bject  calle d  "U ser"that h as  about  a do ze n proper ties (eg: UserGUID, Use rName,  etc. ).It has acon s tru ctor, sta ticmethods, c oup leother  he l pers/ supp o rt  me t hods,  etc . 
The webs i te  ha s hu ndreds of f u n c tio ns/me tho d s wher e 2+  parameters comef rom the User o bjec t .  Fo r e x ampl e: 
public string  He ll o W orld(Gui duserGUID, G uid
 string.Empty))_</td>
 _  <td class="separator">/</td>
_ __<td>@Html.TextBox("Month", (Model.HasValue?_Model.Value.ToString("MM")_: string.Empty))</td>
 _  <td_class="separator">/</td>
   _<td>@Html.TextBox("Year", (Model.HasValue? Model.Value.ToString("yyyy")_:_string.Empty))</td>

With new editor template, validation for model.oneday return true and can be submit this_form._But when_submit,_the_value of oneday is null!_How to fix this problem?

A:

Your_first EditorTemplate_is creating 3 textboxes with the name oneday_When_you submit the_form, the DefaultModelBinder tries to set the value of_oneday to the first value it_sees (a 1_or_2_digit number) which of_course fails (try setting DateTime oneday_= 7; yourself). Even if by_magic it did succeed, the other 2_values would be ignored anyway.
In the_second EditorTemplate your controls have_name="Day",name="Month" and_name="Year". If you inspect Response.Form_you will see_these name/value_pairs but since_you model does not have any_properties named Day,_Month or Year then nothing is_bound_(they are just_ignored).
In_unclear_why you_would want to_do_this, especially_as_you cant use client side validation,_but_you either need

A view model with 3_properties, for Day, Month_and_Year so
that you can_strongly bind to the properties_using html helpers. In
the POST method_you can_then construct_the date based on the 3
properties.
Manually add the (unbound) html as_you are doing in the second_template, and
write your own_custom ModelBinder_that_reads the form_data_values
and builds_the date. An example is shown in_this article.

_Q:

How to determine if passing in_an object is better_than_several parameters (int, string, etc)

I have_a class/object called "User" that has_about a dozen properties (eg:_UserGUID,_UserName,_etc.). It has a constructor,_static methods, couple other helpers/support methods,_etc.
The website has_hundreds of functions/methods where 2+ parameters come_from_the User object. For example:
public string_HelloWorld(Guid_userGUID, Guid