我需要每2小时启动一次网页而不点击按钮,每次关闭旧网页时都要打开新网页。 这是html页面:
@using (Html.BeginForm("Import", "Monitoring", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.Raw(ViewBag.Error)
<br />
<input type="submit" value="Launch" />
}
这是我的导入方法:
string path4 = "D:/Project/TProdPlan.xlsx";
Excel.Application application4 = new Excel.Application();
Excel.Workbook workbook4 = application4.Workbooks.Open(path4);
Excel.Worksheet worksheet4 = workbook4.ActiveSheet;
Excel.Range range4 = worksheet4.UsedRange;
List<TProdPlan> ListTProdPlan = new List<TProdPlan>();
for (int row = 2; row <= range4.Rows.Count; row++)
{
TProdPlan S = new TProdPlan();
S.Num= (((Excel.Range)range4.Cells[row, 1]).Text);
S.stat = (((Excel.Range)range4.Cells[row, 2]).Text);
ListTProdPlan.Add(S);
}
ViewBag.ListTProdPlans = ListTProdPlan;
//close excelsheet after reading data
workbook4.Close(0);
application4.Quit();
return View("Monitoring");
}
这是&#34;监控视图&#34;
<div class="carousel-inner" role="listbox">
<div class="item active">
<h1>Total Seasame Tickets Status (From 16/04 To 22/04)</h1>
<table class="table table-striped">
<thead >
<th style="text-align:center">Number</th>
<th style="text-align:center">Status</th>
<th style="text-align:center">Color Code</th>
</thead>
<tbody style="text-align:center">
@foreach (var Ts in ViewBag.ListTsesames)
{
<tr>
<td>@Ts.Number</td>
<td>@Ts.Status</td>
@if (@Ts.Status == "Resolved")
{
<td><img src="~/Web/Resolved.png" /></td>
}
else if (@Ts.Status == "Opened")
{
<td><img src="~/Web/Opened.png" /></td>
}
else if (@Ts.Status == "Assigned")
{
<td><img src="~/Web/Assigned.png" /></td>
}
else if (@Ts.Status == "PendingCustomer")
{
<td><img src="~/Web/PendingCustomer.png" /></td>
}
else if (@Ts.Status == "Closed Complete")
{
<td><img src="~/Web/Closed Complete.png" /></td>
}
</tr>
}
</tbody>
</table>
<br />
<h1>Total is : 115 </h1>
<div class="carousel-caption">
</div>
</div>
答案 0 :(得分:0)
您可以使用javascript / jquery提交,但如果您只想将用户从一个页面重定向到另一个页面,请使用
window.location = "http://www.yoururl.com";
javascript / jquery允许你使用计时器,在计时器的fire事件中你可以添加我提到的重定向代码。
setInterval(yourfunction, 1000*60*60*2);