2

I have a form where you select a file out of a Html.dropdownlist.

             <%=Html.DropDownList("downloadableFiles", Model.DownloadFiles.Select(df => new SelectListItem
            {
                Value = df.Reference.ToString(), 
                Text = df.Name
            }))%>

The Model.DownloadFiles have the following properties Reference, Name, and CreatedDate

Further along my code, I have the following(Took the first Element's creation date for now):

       <tr>
            <td class="formTableColLeft">
                CreationDate:
            </td>
            <td class="formTableColRight">
                <% Html.Label( Model.DownloadFiles.First( ).CreationDate.ToShortDateString(), "LabelCreatedDate" ); %>
            </td>      
        </tr>  

Question is how do I change the CreationDate text of the label whenever I change the Dropdown? So whenever I change the dropdown it should take the CreationDate of Model.DownloadFiles wherever it is equal to the selected reference and display it in the label.

Thank you in advance

4

0 回答 0