我想在我的标题中点击我的Logo并链接到主页但我不确切知道如何做到这一点.
我的代码:
导航菜单:
HTML
<div id="myMenu">
<div class="myWrapper">
<nav>
<div class="logo"></div>
</nav>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
#myMenu
{
width: 100%;
height: 30px;
z-index: 999;
background-color: #252e30;
}
.myWrapper
{
max-width: 660px;
margin: 0 auto;
}
.logo
{
display: inline-block;
width: 156px;
height: 30px;
margin-top: 5px;
background-size: auto 43px;
background-image: url(../images/mylogo.png);
background-repeat: no-repeat;
}
Run Code Online (Sandbox Code Playgroud)
我希望我的徽标可以点击并链接到页面:Homepage.cshtml
我的main.cs代码:
public string Generate(int length)
{
char[] chars = "$%#@!*abcdefghijklmnopqrstuvwxyz1234567890?;:ABCDEFGHIJKLMNOPQRSTUVWXYZ^&".ToCharArray();
string password = string.Empty;
Random random = new Random();
for (int i = 0; i < length; i++)
{
int x = random.Next(1, chars.Length);
if (!password.Contains(chars.GetValue(x).ToString()))
password += chars.GetValue(x);
else
i--;
}
return password;
}
Run Code Online (Sandbox Code Playgroud)
我做了一个测试代码
[TestMethod]
[Timeout(1000)]
public void RenderingPasswordShouldHaveMaximumSize()
{
var amountOfCharacters = Int32.MaxValue;
var generator = new PasswordGenerator();
var target = generator.Generate(amountOfCharacters);
Assert.Fail("This method should throw an exception if you try to create a password with too …Run Code Online (Sandbox Code Playgroud) 我正在制作一个小应用程序,我需要显示DateTime,但我不知道如何.
我有一个ViewModel:
public class ViewModel
{
public DateTime Time{ get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我有一个名为TimeController的控制器:
public ActionResult Index()
{
ViewModel v = new ViewModel();
v.Time = DateTime.Now;
return View(v);
}
Run Code Online (Sandbox Code Playgroud)
并从索引视图:
ViewBag.Title = "Index";
}
<h2>Hello</h2>
Run Code Online (Sandbox Code Playgroud)
有人可以解释我如何在我的观点上显示时间吗?