title: ASP .Net MVC 5 Get Attributes of properties of model in razor view
body: <p>Hi I manage to make my problem on dropdownlist work but still i encountered another issue. this is my new code;</p>
  
  <pre><code>@foreach (var props in mymodel.GetType().GetProperties().ToList())
          {
              &lt;div class="editor-line"&gt;
                  &lt;label&gt;@props.Name &lt;/label&gt;
                  @(Html.Kendo().DropDownList()
                      .Name("ddl1_" + @props.Name)
                      .OptionLabel("Select")
                      .DataTextField("Text")
                      .DataValueField("Value")
                      .AutoBind(false)                    
                      .Events(e =&gt; e.Change("onSelect"))
                      .HtmlAttributes(new { style = "width: 25%" })
                  )
              &lt;/div&gt;
          }
  </code></pre>
  
  <p>and here's how i populate them, sorry for the bad practice.</p>
  
  <pre><code>@foreach (var props in mymodel.GetType().GetProperties().ToList())
              {
                  &lt;text&gt;
                      var ddl = $('#ddl1_' + "@props.Name").data("kendoDropDownList");
                      ddl.setDataSource(ddlSource);
                  &lt;/text&gt;
              }
  </code></pre>
  
  <p>now my problem is the <code>.Events(e =&gt; e.Change("onSelect"))</code> code is not working, it makes may page fail to load because it cannot find the <code>onSelect</code> function.</p>
  
  <p>here is the code in javsacript</p>
  
  <pre><code>function onSelect(e) {
          debugger;
          if (e.item) {
              var dataItem = this.dataItem(e.item);
              var elementId = e.sender.element[0].id
              console.log(elementId);
              console.log("event :: select (" + dataItem.Text + " : " + dataItem.Value + ")");
          } else {
              console.log("event :: select");
          }
      }
  </code></pre>