小编Sue*_* Su的帖子

@ Html.EditorFor DateTime在设置默认值时不显示

我想在Controller中为我的模型设置一个默认值,但它无法在创建页面中显示.

TestModel代码:

public class TestModel
{
    [DataType(DataType.DateTime), Required]
    [DisplayFormat(DataFormatString = "yyyy/MM/dd", ApplyFormatInEditMode = true)]
    public DateTime StartTime { get; set; }

    [DataType(DataType.DateTime), Required]
    [DisplayFormat(DataFormatString = "yyyy/MM/dd", ApplyFormatInEditMode = true)]
    public DateTime EndTime { get; set; }


    public string Description { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

控制器代码:

public ActionResult Create()
{
    var model = new TestModel();
    model.StartTime = DateTime.Now;
    model.EndTime = DateTime.Now.AddDays(10);
    model.Description = "This is a default value";
    return View(model);
}
Run Code Online (Sandbox Code Playgroud)

查看页面:

<div class="form-group">
    @Html.LabelFor(model => model.StartTime, htmlAttributes: new { @class …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc model string-formatting data-annotations

9
推荐指数
1
解决办法
9292
查看次数

"加入"顺序是否会导致不同的查询性能

我有2个表(table1 table2),table2大于table1.

脚本1:

SELECT t1.A, t2.B
FROM table1 AS t1
JOIN table2 AS t2 ON t1.PK = t2.FK
Run Code Online (Sandbox Code Playgroud)

脚本2:

SELECT t1.A, t2.B
FROM table2 AS t2
JOIN table1 AS t1 ON t1.PK = t2.FK
Run Code Online (Sandbox Code Playgroud)

性能脚本#1是否优于脚本#2?

sql t-sql sql-server

5
推荐指数
1
解决办法
120
查看次数

Epplus Hyper Link 无下划线

我试图按照下面的方法创建一个带有超链接的单元格,但是为什么这个超链接在 Excel 中没有显示下划线。

  public static void AddHyperLinkText(this ExcelRange range, string hyperLink, string displayText)
    {
        range.Hyperlink = new ExcelHyperLink(hyperLink);
        range.Value = displayText;
    }
Run Code Online (Sandbox Code Playgroud)

你可以帮帮我吗?

最好的问候, 苏

c# excel hyperlink epplus

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