1
+ @using Syncfusion .EJ2
2
+ @section ControlsSection{
3
+ <div class =" col-lg-12 control-section" >
4
+ <div id =" listbox-control" >
5
+ @Html.EJS().ListBox( " listbox" ).DataSource ((IEnumerable <object >)ViewBag .data ).ItemTemplate (
6
+ " <div class=\" list-wrapper\" ><span class=\" e-avatar e-avatar-xlarge e-avatar-circle\" ><img src=\" ../Content/listbox/pic/${pic}.svg\" alt=\" pic\" /></span><span class=\" text\" > ${text} </span><span class=\" description\" > ${description} </span></div>" ).Render ()
7
+ </div >
8
+ </div >
9
+ }
10
+
11
+ @section Meta{
12
+ <meta name =" description" content =" This example demonstrates the Template in ASP.NET MVC List Box control. Explore here for more details." />
13
+ }
14
+ @section ActionDescription{
15
+ <div id =" action-description" >
16
+ <p >This sample demonstrates the Template of a ListBox . Here , SVG icons were used for visual representation of every list items</p>
17
+ </div>
18
+ }
19
+ @section Description{
20
+ <div id =" description" >
21
+ <p >
22
+ The <code >ListBox </code >is a graphical user interface component used to display a list of items . This sample illustrates how to integrate the item template to customize the
23
+ list item 's content and this can be specified by using <b >ItemTemplate </b > property .</p >
24
+ <p >
25
+ In this sample , data is bound to the ListBox using the <a target = " _blank" href = " https://help.syncfusion.com/cr/cref_files/aspnetmvc-js2/Syncfusion.EJ2~Syncfusion.EJ2.DropDowns.ListBox~DataSource.html" >
26
+ < code >
27
+ DataSource .
28
+ < / code >
29
+ < / a > property .
30
+ < / p >
31
+ < p >
32
+ More information about the ListBox can be found in the
33
+ < a href = " https://ej2.syncfusion.com/aspnetmvc/documentation/list-box/getting-started" target = " _blank" > documentation section < / a > .
34
+ < / p >
35
+ < / div >
36
+ }
37
+
38
+ @* custom code start*@
39
+
40
+ <style >
41
+ #listbox-control {
42
+ width : 350px ;
43
+ margin : auto ;
44
+ }
45
+
46
+ @@media screen and (max-width : 590px ) {
47
+ #listbox-control {
48
+ width : 100% ;
49
+ }
50
+ }
51
+
52
+ .list-wrapper {
53
+ height : inherit ;
54
+ position : relative ;
55
+ padding : 14px 12px 14px 78px ;
56
+ }
57
+
58
+ .list-wrapper .text ,
59
+ .list-wrapper .description {
60
+ display : block ;
61
+ margin : 0 ;
62
+ padding-bottom : 3px ;
63
+ white-space : normal ;
64
+ }
65
+
66
+ .list-wrapper .description {
67
+ font-size : 12px ;
68
+ font-weight : 500 ;
69
+ }
70
+
71
+ #listbox-control .e-listbox-wrapper .list-wrapper .text {
72
+ font-weight : bold ;
73
+ font-size : 13px ;
74
+ }
75
+
76
+ .list-wrapper .e-avatar {
77
+ position : absolute ;
78
+ left : 5px ;
79
+ background-color : transparent ;
80
+ font-size : 22px ;
81
+ top : calc (50% - 26px );
82
+ }
83
+
84
+ .list-wrapper .e-avatar {
85
+ width : 50px ;
86
+ height : 50px ;
87
+ background-repeat : no-repeat ;
88
+ margin-left : 10px ;
89
+ }
90
+ </style >
91
+
92
+ @* custom code end*@
93
+
94
+ @section Title{
95
+ <title >ASP .NET MVC List Box Template Example - Syncfusion Demos </title >
96
+ }
97
+ @section Header{
98
+ <h1 class =' sb-sample-text' >Example of Template in ASP .NET MVC List Box Control </h1 >
99
+ }
0 commit comments