none
ASP.NET MVC4.0 使用多选下拉框 RRS feed

  • 问题

  • 请问在VS2012 ASP.NET MVC4.0上能使用http://www.erichynds.com/blog/jquery-ui-multiselect-widget中的MultiSelect吗?为什么我的代码显示出来就是个list呢?请指教。我是初学者。

    View中的代码如下:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>jQuery MultiSelect Widget Demo</title>
        <link rel="stylesheet" type="text/css" href="~/CSS/jquery.multiselect.css" />
        <link rel="stylesheet" type="text/css" href="~/CSS/style.css" />
        <link rel="stylesheet" type="text/css" href="~/CSS/prettify.css" />
        <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
        <script type="text/javascript" src="</script">http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
        <script type="text/javascript" src="</script">http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
        <script type="text/javascript" src="~/CSS/prettify.js"></script>
        <script type="text/javascript" src="~/CSS/jquery.multiselect.js"></script>
        <script type="text/javascript">
            $(function () {
                $("select").multiselect();
            });
        </script>
    </head>
    <body id="test" onload="prettyPrint();">

    <h2>Basic Demos</h2>

    <p>Both multiselects are created with the following one-liner.  Optgroup support is built in out of the box:</p>
    <pre class="prettyprint">
    $(function(){
       $("select").multiselect();
    });
    </pre>

    <h3>Basic</h3>
    <p>
     <select title="Basic example" multiple="multiple" name="example-basic" size="5">
     <option value="option1">Option 1</option>
     <option value="option2">Option 2</option>
     <option value="option3">Option 3</option>
     <option value="option4">Option 4</option>
     <option value="option5">Option 5</option>
     <option value="option6">Option 6</option>
     <option value="option7">Option 7</option>
     <option value="option8">Option 8</option>
     <option value="option9">Option 9</option>
     <option value="option10">Option 10</option>
     <option value="option11">Option 11</option>
     <option value="option12">Option 12</option>
     </select>
    </p>

    <h3>With Optgroups</h3>
    <p>Click on an optgroup's heading to toggle the checked state of the entire group.</p>
    <p>
     <select name="example-optgroup" multiple="multiple" size="5">
     <optgroup label="Group One">
      <option value="option1">Option 1</option>
      <option value="option2">Option 2</option>
      <option value="option3">Option 3</option>
     </optgroup>
     <optgroup label="Group Two">
      <option value="option4">Option 4</option>
      <option value="option5">Option 5</option>
      <option value="option6">Option 6</option>
      <option value="option7">Option 7</option>
     </optgroup>
     </select>
    </p>

    </body>
    </html>


    guiwenyang

    2013年10月30日 2:48

全部回复

  • 请勿在站务版发技术问题。


    Visual C++ MVP

    2013年10月30日 21:22
    版主
  • 多选的话应该是一个List,您希望何种效果呢?

    For Account Validation, please follow "Verify Account+Number" at http://social.msdn.microsoft.com/Forums/en-us/home?forum=reportabug

    For ASP.NET Question, please ask at http://forums.asp.net

    For other questions, you can ask at http://stackexchange.com/sites

    Click and Donate at http://www.freerice.com

    2013年11月2日 4:09
  • 你好,

          使用MultiSelect后就是一个List,但是通过"Ctrl+Click" 方式可以多选。

          你能看下面这个Demo:

         http://jsfiddle.net/ehynds/rTjkr/


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2013年11月5日 1:42
    版主