小编gen*_*eek的帖子

如何设置MVC3/ASP.net DropDownList的样式?

我怎样才能在css中为mvc3/asp.net DropDownList设置样式,就像我可以使用文本框一样:

--Site.css - 文本框样式 -

input[type="text"], 
input[type="password"] {
    border: 1px solid #93A9C8;
    padding: 2px;
    font-size: 1em;
    color: #444;
    width: 200px;
    border-radius: 3px 3px 3px 3px;
    -webkit-border-radius: 3px 3px 3px 3px;
    -moz-border-radius: 3px 3px 3px 3px;
    -o-border-radius: 3px 3px 3px 3px;
Run Code Online (Sandbox Code Playgroud)

}

MVC3显示:

在此输入图像描述

html css css3 asp.net-mvc-3

3
推荐指数
1
解决办法
1万
查看次数

保存父实体时,对包含的集合的模型更新未保存在DB中?

问题: MVC3和实体框架4.1中的子模型集合正在通过编辑操作在模型中正确更新,但这些值未保存在DB中.

概述: - 模型对象Person包含对象CaseRef - 人员属性更新将保存在db.SaveChanges()上的DB中,但内部集合CaseRef属性更新未被保存 - 所有值在HttpPost ActionResult编辑时正确绑定/映射( )因此,从表单提交(编辑视图)成功更新模型.

楷模:

public  class Person
{
    public Person()
    {
        this.CaseRefs = new HashSet<CaseRef>();
    }  
   // <...more properties here...>
    public string Name { get; set; }
    public int UserId {get; set}

    public virtual ICollection<CaseRef> CaseRefs { get; set; }     
}

public  class CaseRef
{
   // <...more properties here...>
   public int DescId { get; set; }  
   public virtual Person Person { get; set; }  
}
Run Code Online (Sandbox Code Playgroud)

控制器 - 编辑(发布)

    [HttpPost]
    public ActionResult Edit(Person …
Run Code Online (Sandbox Code Playgroud)

entity-framework-4.1 asp.net-mvc-3

3
推荐指数
1
解决办法
1727
查看次数

宽HTML表在页面右侧运行 - 如何启用浏览器的水平滚动条?

我目前有一个非常宽的数据视图作为一个普通的html表,当它是100%或更多时,它运行在浏览器的右侧,不允许整个数据视图.

如何启用浏览器的水平滚动条以便用户可以滚动查看整个内容(我将宽度设置为100%,但没有做任何事情)?

谢谢!

html css

3
推荐指数
1
解决办法
4829
查看次数

Uploadify - MVC3:HTTP 302重定向错误(由于asp.net身份验证)

我正在使用uploadify来批量上传文件,我收到302重定向错误.我假设这是因为在脚本调用中没有传回一些asp.net身份验证cookie令牌.

我有一个普通的裸机mvc3应用程序上传,但当我尝试将其集成到一个安全的asp.net mvc3应用程序时,它试图重定向到帐户/登录.

我有一个身份验证令牌(@auth),它在视图中作为一个长字符串返回,但我仍然得到302重定向错误.

有关如何发送cookie身份验证数据的任何想法?

视图:

 @{
     string auth = @Request.Cookies[FormsAuthentication.FormsCookieName] == null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value;
     }


<script type="text/javascript">
    jQuery.noConflict();
    jQuery(document).ready(function () {
        jQuery("#bulkupload").uploadify({
            'uploader': '@Url.Content("~/Scripts/uploadify.swf")',
            'cancelImg': '/Content/themes/base/images/cancel.png',
            'buttonText': 'Browse Files',
            'script': '/Creative/Upload/',
            scriptData: { token: "@auth" }, 
            'folder': '/uploads',
            'fileDesc': 'Image Files',
            'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
            'sizeLimit': '38000',
            'multi': true,
            'auto': true,
              'onError'     : function (event,ID,fileObj,errorObj) {
      alert(errorObj.type + ' Error: ' + errorObj.info);
    }
        });
    }); 
    </script> 
Run Code Online (Sandbox Code Playgroud)

控制器:

public class CreativeController : Controller
{
    public string Upload(HttpPostedFileBase fileData, string …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc uploadify asp.net-mvc-3

3
推荐指数
1
解决办法
2617
查看次数

favicon.ico 在 Tomcat 7.0 的 spring mvc 3.2.2 中不显示?

我是 spring mvc 新手,我的 favicon.ico 没有显示在使用 spring 3.2.2 使用 tomcat 7.0 的浏览器选项卡中。我尝试查看相关的谷歌搜索,但仍然无法让它显示在浏览器选项卡中(FF、Chrome、IE...所有最新版本都不起作用)以及清除缓存并重新启动浏览器。

  • 图标.ico

位于 webapp 文件夹的根目录 (src/main/webapp)

  • 索引.jsp
<!DOCTYPE html>  
      <html> 
         <head>         
            <link href="favicon.ico" rel="shortcut icon" >
  o o o
Run Code Online (Sandbox Code Playgroud)
  • mvc-dispatcher-server.xml
<context:component-scan base-package="com.website.controllers" />

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  <property name="prefix">
      <value>/WEB-INF/views/</value>
  </property>
  <property name="suffix">
      <value>.jsp</value>
  </property>
</bean>
Run Code Online (Sandbox Code Playgroud)
  • 网络.xml
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
Run Code Online (Sandbox Code Playgroud)
<servlet>
    <servlet-name>mvc-dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>mvc-dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)

java favicon tomcat spring-mvc

3
推荐指数
1
解决办法
6275
查看次数

如何从引导中重用模式HTML?

我有一些包含不同内容的不同模式对话框。基本上,单击button1显示模式对话框1 ...单击button2显示模式对话框2,依此类推。

如何在JavaScript或其他可重用容器中重用该html代码并将数据传递给一个可重用模态?

button1单击的基本代码和modalDialog1的支持代码:

按钮代码(用于单击以显示模式)

<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>
Run Code Online (Sandbox Code Playgroud)

用于显示模式的HTML ...如何在JavaScript函数或其他方式中重用此代码,并为模式标题和classIDThatContainstheContentsforModal传递一些变量,以便模式可重复使用?

不知道这是否可以纳入JavaScript或其他方法中。

<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Modal Header</h3>
  </div>
  <div class="modal-body">
    <div id="container" class="classIDThatContainstheContentsforModal">
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    <button class="btn btn-primary">Save changes</button>
  </div>
</div> 
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap

3
推荐指数
1
解决办法
5185
查看次数

高图表对数刻度?

我尝试设置

pointStart: 1
Run Code Online (Sandbox Code Playgroud)

对于每个数据系列,但是我有三个数据系列,并且无法弄清楚如何以对数形式缩放整个图表?

小提琴-> http://jsfiddle.net/EwpWh/3/

highcharts highstock

3
推荐指数
1
解决办法
3824
查看次数

每个spring source ide的springframework.org/tags形式的maven参考?

嗨,我是java新手,我从以下来自我继承的.jsp的行中得到以下错误.使用spring source作为我的编辑器.

注意:根据我最新的eclipse(kepler)IDE,这个加载很好.

<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
Run Code Online (Sandbox Code Playgroud)

错误:

找不到" http://www.springframework.org/tags/ form"的标签库描述符找不到" http://www.springframework.org/ tags" 的标签库描述符

我的pom.xml中定义了以下内容:

<spring.version>3.2.1.RELEASE</spring.version>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${spring.version}</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>${spring.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

java eclipse spring sts-springsourcetoolsuite

3
推荐指数
1
解决办法
2万
查看次数

从字符串中删除斜体和粗体html标签?

删除粗体和斜体比下面更安全的方法是什么?

        String text = "<b>Remove <i>bold</i> and italics</b>";
        System.out.println(text);
        text = text.replaceAll("\\<.*?\\>", ""); //remove all but only want to remove b and i?
        System.out.println(text);
Run Code Online (Sandbox Code Playgroud)

此外,更具可扩展性(如果我想包括其他标签,如"强"或"em",并允许区分大小写"b"与"B"等,)?

html java regex

3
推荐指数
1
解决办法
3717
查看次数

如何通过格式化的 json 在 pre 标签中显示中断?

我有一些想要在网页中显示的 json。但是, pre 标签正在剥离并尊重输出中的中断?

如何显示一些 json 并保持所有文本原样?

注意:我无法控制语法。这就是进入我的服务的内容,所以我只是将它取出并在 html 中将它注入到 pre.txt 中。

<div>
    <pre>
        {
        "text:" "testing line breaks<br/>new line"
        }
    </pre>
</div>
Run Code Online (Sandbox Code Playgroud)

输出:

{
 "text:" "testing line breaks
new line"
}
Run Code Online (Sandbox Code Playgroud)

预期输出:

{
 "text:" "testing line breaks<br/>new line"
}
Run Code Online (Sandbox Code Playgroud)

html css json

3
推荐指数
2
解决办法
1万
查看次数