我有一些代码:
<table>
@foreach (var invoiceLine in Model.Invoice.InvoiceLine)) {
<tr class="subheader">
<td>
<div class="approval">
<span>Office sign off:</span>
@Html.DisplayFor(modelItem => item.OfficeUser.Name)
<span id="officeapprovalspan">@(item.OfficeApproved.HasValue ? (item.OfficeApproved.Value ? "Accepted" : "On Hold") : "Please Approve")</span>
</div>
</td>
Run Code Online (Sandbox Code Playgroud)
好吧,id="officeapprovalspan"我希望设置它的id,以便它是officapprovalspan"x",其中x是当前项目invoiceLineId.
所以当invoiceLineId = 3时,理想情况下我想要span id id="officeapprovalspan3"
谁知道如何实现这一目标?
我想做这样的事情:
视图
<td class="status_@Model.IsActive">
@Model.Description
</td>
Run Code Online (Sandbox Code Playgroud)
CSS
<style type="text/css">
.status_True
{
background-color: Red;
}
.status_False
{
background-color: Green;
}
</style>
Run Code Online (Sandbox Code Playgroud)
@Model.IsActive是回归True还是False.当然这段代码不起作用.
类的Html输出是: class="status_@Model.IsActive"
我的预期输出是: class="status_True"
这可能是做这样的逻辑吗?如果可能,我该怎么办?还是另一种改变css类的方法?可能有不同的方式.
谢谢.
HTML:
<div id="myID" onclick="cc(this.id)">Click Here</div>?
Run Code Online (Sandbox Code Playgroud)
JavaScript的:
var timer;
var firing = false;
var begen = function(id) {
alert('tek');
};
var popupAc = function(id) {
alert('çift');
};
function cc(id) {
if (firing) {
popupAc(id);
clearTimeout(timer);
firing = false;
return;
}
firing = true;
timer = setTimeout(function() {
//begen(id);
clearTimeout(timer);
firing = false;
}, 250);
}
Run Code Online (Sandbox Code Playgroud)
错误:
Uncaught ReferenceError: cc is not defined
Run Code Online (Sandbox Code Playgroud)
我有以下数组:
double[] Series = new double[] { 7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6 }
Run Code Online (Sandbox Code Playgroud)
系列调试视图:
> Series
--> [0]
--> [1]
--> ...
--> [10]
--> [11]
Run Code Online (Sandbox Code Playgroud)
当我写下面的内容时:
object[] object_array = new object[] { Series }
Run Code Online (Sandbox Code Playgroud)
object_array调试视图:(多个级别)
> object_array
--> [0]
----> [0]
----> [1]
----> ...
----> [10]
----> [11]
Run Code Online (Sandbox Code Playgroud)
我写下以防止新的水平:
object[] object_array = new object[Series.Length];
for (int i = 0; i < Series.Length; i++)
{
object_array[i] = Series[i];
}
Run Code Online (Sandbox Code Playgroud)
这是其他解决方案之一.但我认为,可能有更好的方法来做到这一点.我使用上面的循环是否有问题?还是不同的方式?
(我使用highcharts.如果我给出包含多个级别的数组,它就不起作用.)
谢谢.
public ActionResult _Upload(HttpPostedFileBase file, GaleriesViewModel galeriesViewModel)
{
Images image = new Images();
if (file.ContentLength > 0)
{
try
{
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/Images/Galeries/Galery_" + galeriesViewModel.sno), fileName);
var smallImagePath = Path.Combine(Server.MapPath("~/Images/Galeries/Small/Galery_" + galeriesViewModel.sno), fileName);
var db_file_url = "Images/Galeries/Galery_" + galeriesViewModel.sno + "/" + fileName;
var db_small_image_url = "Images/Galeries/Small/Galery_" + galeriesViewModel.sno + "/" + fileName;
//exception thrown in this line
file.SaveAs(path);
Image smallImage = Image.FromFile(path);
Size size = new Size();
size.Height = 128;
size.Width = 128;
smallImage = …Run Code Online (Sandbox Code Playgroud) 我想使用EasyUI jquery树.所以我创建了一个用于此jquery树的类.
Jquery树数据格式示例
[{
"id":1,
"text":"Folder1",
"iconCls":"icon-save",
"children":[{
"text":"File1",
"checked":true
},{
"text":"Books",
"state":"open",
"attributes":{
"url":"/demo/book/abc",
"price":100
},
"children":[{
"text":"PhotoShop",
"checked":true
},{
"id": 8,
"text":"Sub Bookds",
"state":"closed"
}]
}]
},{
"text":"Languages",
"state":"closed",
"children":[{
"text":"Java"
},{
"text":"C#"
}]
}]
Run Code Online (Sandbox Code Playgroud)
我的模特
public class MetersTreeNode
{
public int id { get; set; }
public string text { get; set; }
public string state { get; set; }
public bool checked { get; set; } //I cant define.
public string attributes { get; …Run Code Online (Sandbox Code Playgroud) Index.cshtml
@{
ViewBag.Title = "Index";
}
<script src="~/Scripts/jquery.signalR-2.0.0.min.js"></script>
<script>
$(function () {
var connection = $.connection('/echo');
connection.received(function (data) {
$('#messages').append('<li>' + data + '</li>');
});
connection.start().done(function () {
$("#broadcast").click(function () {
connection.send($('#msg').val());
});
});
});
</script>
<input type="text" id="msg" />
<input type="button" id="broadcast" value="broadcast" />
<ul id="messages">
</ul>
Run Code Online (Sandbox Code Playgroud)
startup.cs
using Microsoft.Owin;
using Owin;
using UI;
namespace UI
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
}
Run Code Online (Sandbox Code Playgroud)
MyConnection.cs
public class MyConnection : PersistentConnection
{
protected override …Run Code Online (Sandbox Code Playgroud) 我正在制作一个 div 并且点击 div 我正在制作一些表格。我正在获取表值。我希望我的表格可以滚动。
这是我的代码。
var myTable = '<input type="text" id="myInput" onkeyup="myFunction()" title="Type in a name">'+
'<table id="myTable">'+ '<tr class="header"></tr>' + '<tr><td></td></tr>'+ '</table>';
Run Code Online (Sandbox Code Playgroud)
我从某个代理获取这个表数据。我希望表格的大小应该受到限制,如果数据更多,这应该是可滚动的。
我在这里应用的 CSS 是
#myInput {
background-image: url('Drop.png');
background-position: 10px 10px;
background-repeat: no-repeat;
width: 30%;
font-size: 16px;
padding: 12px 20px 12px 40px;
border: 1px solid #ddd;
margin-bottom: 12px;
}
Run Code Online (Sandbox Code Playgroud)
以任何方式进行此操作。
我想将DataTable作为Json格式在图表上显示.
public JsonResult GetDataTable()
{
DataTable dt = new DataTable();
dt.Columns.Add("Jan");
dt.Columns.Add("Feb");
dt.Columns.Add("Mar");
dt.Columns.Add("Apr");
for (int i = 0; i < 10; i++)
{
dt.Rows.Add(i * 5, i * 10, i * 15, i * 11);
}
// JsonDataTable = dt to Json
return new JsonResult
{
Data = new
{
success = true,
chartData = JsonDataTable
},
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
}
Run Code Online (Sandbox Code Playgroud)
如何将DataTable转换为Json?
谢谢.
我已创建一个的WebGrid其用于显示数据转换成表格形式,但我想通过使用该复选框我想perorm操作检查所有其它复选框成的WebGrid并执行主动和删除操作,增加在的WebGrid的报头部分的复选框. .so请帮我如何创建它..我的Webgrid代码:
<div id="mygrid">
@grid.GetHtml(tableStyle: "gridTable",
headerStyle: "gridHead",
footerStyle: "gridFooter",
rowStyle: "gridRow",
alternatingRowStyle: "gridAltRow",
columns: grid.Columns(
grid.Column(header: "",format: @<text><input type="checkbox" name="chkactive[]" value="@item.User_id" /></text>),
grid.Column("User_Id"),
grid.Column("Name"),
grid.Column("Username"),
grid.Column("Fb_Id"),
grid.Column("User_image", format: @<text><img src="@Url.Content(@item.Image_path)" height="30px" width="50px" alt="noimage"/></text>),
grid.Column("Email"),
grid.Column("Gender"),
grid.Column(header: "Status", format: @<text>
@if (@item.Is_active == true)
{
<a href="@Url.Action("UserStatus", "Admin", new { id = @item.User_id })"><img src="../../images/Active.png"/></a>
}
else
{
<a href="@Url.Action("UserStatus", "Admin", new { id = @item.User_id })"><img src="../../images/Deactive.png"/></a> }</text>),
grid.Column(header: "Edit",
format: @<text><a href="@Url.Action("EditeUser", "Admin", new { id = @item.User_id …Run Code Online (Sandbox Code Playgroud)