Setting font size for a DropDownListFor
I am trying to set the font size of the data inside a DropDownListFor. I can set the size for all the other text in the grid, however, I can't seem to control the text inside the DropDownListFor.
<% foreach (var item in Model) { %>
<tr>
<td>
<%: Html.DropDownListFor(listitem => item.AttendStatusType, new SelectList((IEnumerable)ViewData["status"], "Value", "Text",item.AttendStatusType), new { @class="attendStatusList", id = "student" + item.Id + "attendStatus" })%>
</td>
</tr>
<% } %>
I have tried many different things but开发者_如何学运维 nothing seems to make a difference.
Well, I finally figured out how to do it, here was the solution:
<% foreach (var item in Model) { %>
<tr>
<td>
<%: Html.DropDownListFor(listitem => item.AttendStatusType, new SelectList((IEnumerable)ViewData["status"], "Value", "Text",item.AttendStatusType), new { @class="attendStatusList", id = "student" + item.Id + "attendStatus",style="font-size:90%;" })%>
</td>
</tr>
<% } %>
by simply adding the ,style="font-size:90%;" it worked. Should have worked using the Site.css or div wrapper, but neither one of those worked.
精彩评论