参考下面的HTML,有四个DIV容器,每个容器包含一个图像,heading-element,paragraph-element和一个链接.当页面在全尺寸计算机显示器上打开时,我希望三个div在屏幕上并排排列.
到目前为止,它们只是垂直向下堆叠在屏幕上.
<div class="threeSpread">
<div class="outer">
<img src="imagesForNew/new1.jpg">
<h2>CHININESE INVESTORS COME TO DETROIT</h2>
<p>"the Shanghai-based developer Dongdu International (DDI) made its first move. In an online auction, it snapped up three iconic downtown properties, all built during the citys early 20th-century"</p>
<a href="http://www.theguardian.com/cities/2014/jul/22/does-multimillion-dollar-chinese-investment-signal-detroits-rebirth">theguardian.com</a>
</div>
<div class="inner">
<img src="imagesForNew/new1.jpg">
<h2>CHININESE INVESTORS COME TO DETROIT</h2>
<p>"the Shanghai-based developer Dongdu International (DDI) made its first move. In an online auction, it snapped up three iconic downtown properties, all built during the citys early …Run Code Online (Sandbox Code Playgroud) 这是EverythingController中动作方法MovieCustomer的粘贴.Viewmodel用于组合两个模型:Customer和Movies,并通过ApplicationDbContext(_context)填充来自数据库的信息.
路由功能成功运行,并在有MovieId和CustomerId值时呈现页面
例如/ Everything/MovieCustomer/1/1
如果一个或两个值为null,我希望页面也加载.到目前为止,两个int参数都是可空的,并且在方法中有一个if语句,如果其中任何一个为null,则将参数更改为1.到目前为止,如果值为null,则浏览器返回404错误.
当一个参数或其中一个参数为空时,如何使页面正常工作?谢谢
[Route("Everything/MovieCustomer/{movieId}/{customerId}")]
public ActionResult MovieCustomer(int? movieId, int? customerId)
{
var viewmodel = new ComboViewModel
{
_Customers = new List<Customer>(),
_Movies = new List<Movies>(),
_customer = new Customer(),
_movie = new Movies()
};
viewmodel._Customers = _context.Customers.ToList();
viewmodel._Movies = _context.Movies.ToList();
if (!movieId.HasValue)
movieId = 1;
if (!customerId.HasValue)
customerId = 1;
viewmodel._customer = viewmodel._Customers.SingleOrDefault(a => a.Id == customerId);
viewmodel._movie = viewmodel._Movies.SingleOrDefault(a => a.Id == movieId);
return View(viewmodel);
}
Run Code Online (Sandbox Code Playgroud) 以下是位于Form1.cs文件中的程序的一部分,该程序启动时使用值填充domainUpDown小部件。我在Form1加载时调用该方法。
程序启动时会加载Form1,但不会触发Form1_Load方法。
为什么不触发Form1_Load方法?
private void BindDomainIUpDown()
{
for (int i = 1; i <= 999; i++)
{
domainUpDown1.Items.Add(i);
}
domainUpDown1.Text = "100";
}
private void Form1_Load(object sender, EventArgs e)
{
BindDomainIUpDown();
}
Run Code Online (Sandbox Code Playgroud)