Custom mvc control and mvc Control

Source: Internet
Author: User
Tags date1

Custom mvc control and mvc Control

// Customize a DatePicker. cshtml File
@ Helper Init () {<link href = "~ /Content/mobiscroll.custom-2.5.0.min.css "rel =" stylesheet "/> <script src = "~ /Scripts/mobiscroll. custom-2.5.0.min.js & gt; </script & gt; // Date font color & lt; style & gt. dw-I {color: # fff ;}</style >}@ helper Render (params string [] controlIds) {if (controlIds! = Null) {<script type = "text/javascript" >$ (function () {@ foreach (var item in controlIds) {@:$ ("# @ item "). mobiscroll (). date ();} var currYear = (new Date ()). getFullYear (); // initialization date control var opt = {preset: 'date', // date, optional: date \ datetime \ time \ tree_list \ image_text \ select theme: 'default', // skin style, optional: default \ android-ics light \ android-ics \ ios \ jqm \ sense-ui \ wp light \ wp display: 'modal', // display mode. Optional values: modal \ inline \ bubble \ top \ bottom mode: 'scroler', // Date selection mode. Optional values: scroller \ clickpick \ mixed lang: 'zh ', dateFormat: 'yyyy-mm-dd', // Date Format setText:' OK ', // confirm the button name cancelText: 'cancel', // The cancel button name is dateOrder: 'yyyymmdd', // The date format in the panel is dayText: 'day', monthText: 'month', yearText: 'Year', // The year, month, and day text in the panel showNow: false, nowText: "Today", startYear: currYear-5, // start year endYear: currYear // End Year }; @ foreach (var item in controlIds) {@: $ ("# @ item "). mobiscroll (opt) ;}}); </script> }}

Use

// @ DatePicker. Init () @ DatePicker. Render ("date1", "date2") on the view page ")
<Div> <input type = "text" placeholder = "Release Start Time" id = "date1" value = "@ ViewBag. SDate "/> <input type =" text "placeholder =" Release End Time "id =" date2 "value =" @ ViewBag. EDate "/> </div>

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.