html - 显示两个选择框的标签

标签 html css razor

我在我的 asp.net mvc Web 应用程序中有以下 View :-

@using (Html.BeginForm("CustomersDetails", "Home"))
{
    <strong>Available Customers</strong>
    <select id="SelectLeft" multiple="multiple">
    @foreach (var item2 in Model.OrderBy(a => a.ORG_NAME))
    {
        <option value = "@item2.ORG_ID" >@item2.ORG_NAME</option>
    }
    </select>      
    <input id="MoveRight" type="button" value=" Add >> " />
    <input id="MoveLeft" type="button" value=" << Remove " /> 
    <strong>Customer to be Exported</strong>
    <select id="SelectRight" name="SelectRight" multiple="multiple">           
    </select>
    <p><button type="submit" id ="nextpage">Next Page >></button></p>
}   

页面的布局不像我期望的那样,我面临这些问题:-
  • 两个粗体标签“Avilable customer”和“Customer to be Exported”显示在选择框旁边而不是它们上方。
  • “添加>>”和“<<删除”按钮彼此并排显示,但我需要将它们显示在彼此上方。
    任何人都可以建议我可以遵循的方法以使布局更加用户友好吗?
    BR
  • 最佳答案

    尝试这样的事情:

    @using (Html.BeginForm("CustomersDetails", "Home"))
    {
        <text>
            <strong>Available Customers</strong>
            <br style='clear:both;' />
            <select id="SelectLeft" multiple="multiple">
            @foreach (var item2 in Model.OrderBy(a => a.ORG_NAME))
            {
                <option value = "@item2.ORG_ID" >@item2.ORG_NAME</option>
            }
            </select>      
    
            <input id="MoveRight" type="button" value=" Add >> " />
            <br style='clear:both;' />
            <input id="MoveLeft" type="button" value=" << Remove " /> 
    
            <strong>Customer to be Exported</strong>
            <br style='clear:both;' />
            <select id="SelectRight" name="SelectRight" multiple="multiple">           
            </select>
            <p>
                <button type="submit" id ="nextpage">Next Page >></button>
            </p>
        </text>
    }
    

    如果您使用 float css 属性,它们将显示在旁边。尝试使用 clear 清除( float )两侧br 中的属性(property)(断线)标签。

    关于html - 显示两个选择框的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14044361/

    相关文章:

    javascript - 通过 PHP&AJAX 自动链接短接 (bit.ly)

    jquery - JavaScript for 循环增量不起作用

    css - 寻找支持最大宽度 968px 的轻量级响应式 CSS 框架

    asp.net-mvc - MVC View 从不存在的代码中抛出错误

    javascript - 想要将添加的元素移动到 DOM 的不同部分

    php - 可以像 html 文件一样在 Internet 上查看 php 文件吗?

    php - 我可以单独使用 iframe、HTML 和 CSS 在另一个外部网站上显示我的博客的博客标题吗

    javascript - CSS 中的伪元素

    ASP.NET MVC 渲染模型作为隐藏字段

    asp.net - 在布局中添加 PartialView