String and Objects

C1 MVC's input module includes several controls for entering and editing strings:

  • ComboBox: Combines an input element with a drop-down list and provides as-you-type search, making it quick and easy to find items in long lists. Use it to enter strings or to select objects from lists.

    For example, select a country:

  • AutoComplete: Extends the ComboBox to provide as-you-type async loading of items and a customizable search algorithm. Use it to select items from large datasets on the server.

    For example, type 'land' or 'uni':

  • InputMask: Provides character-level validation by allowing you to specify a mask composed of templates that constrain each character typed by the user.

    For example, type a phone number:

1
2
3
4
5
6
7
8
9
10
11
12
13
using System.Web.Mvc;
 
namespace LearnMvcClient.Controllers
{
    public partial class C1InputController : Controller
    {
        // GET: StringObjects
        public ActionResult StringObjects()
        {
            return View(Models.PopulationGdp.GetData());
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@model IEnumerable<PopulationGdp>
 
<h1>
    @Html.Raw(Resources.C1Input.StringObjects_Title)
</h1>
 
<p>
    @Html.Raw(Resources.C1Input.StringObjects_Text1)
</p>
<ul>
    <li>
        <p>
            @Html.Raw(Resources.C1Input.StringObjects_Text2)
        </p>
        <p>
            @Html.Raw(Resources.C1Input.StringObjects_Text3)
            @Html.C1().ComboBox().Id("theCombo").Bind(Model).DisplayMemberPath("Country")
        </p>
    </li>
    <li>
        <p>
            @Html.Raw(Resources.C1Input.StringObjects_Text4)
        </p>
        <p>
            @Html.Raw(Resources.C1Input.StringObjects_Text5)
            @Html.C1().AutoComplete().Id("theAutoComplete").Bind(Model).Placeholder(Resources.C1Input.StringObjects_Text6).DisplayMemberPath("Country")
        </p>
    </li>
    <li>
        <p>
            @Html.Raw(Resources.C1Input.StringObjects_Text7)
        </p>
        <p>
            @Html.Raw(Resources.C1Input.StringObjects_Text8)
            @Html.C1().InputMask().Id("theInputMask").Mask("1 (000) 99-999").Value("1 (800)")
        </p>
    </li>
</ul>