如何在同一标签的 2 个文本之间用 Html.Helper 写在 1 行中

How to write in 1 line with the Html.Helper between 2 text in the same label

在 .cs 中使用 HtmlHelper 的代码如下html:

<div class="row form-group col-lg-12" >
   @Html.RadioButtonFor(m => m.ScheduleType, "Montly")
   <label>
       On the 
       @Html.DropDownListFor(model => model.DayOfMonth, Model.DayOfMonthList, new { @class = "form-control select2"}) 
       of the month
    </label>
</div>

我想在 1 行中打印这 2 个 HtmlHelper(RadioButton 将 enable/disable 下拉菜单)

现在,我得到的结果是显示如下图所示的单选按钮。我想在一行中打印所有内容。有没有一种方法可以通过更改剃刀、html 或视图在同一行中打印所有这些,或者它需要由其他东西管理? (css, jquery, 等等)

您可以在 DropDownListFor 和文本块周围添加一个带有内联块的包装器 class div。它可以防止它们填满整行,从而使它们彼此相邻,如下例所示。

.wrapper {
  display: inline-block;
}
<label>
    On the 
    <div class="wrapper">
        <select id="dayOfMonth">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
        </select> 
   </div>
   of the month
</label>