我已经做了我的第一个网站使用MVC 5这在我的本地机器上工作正常,但当我把它发布到服务器的一些CSS的不正确加载.
/* Minification failed. Returning unminified contents.
(80,1): run-time error CSS1019: Unexpected token, found '@import'
(80,9): run-time error CSS1019: Unexpected token, found 'url('../Content/dark-skin/skin.css')'
(671,16): run-time error CSS1062: Expected semicolon or closing curly-brace, found ':'
(1288,16): run-time error CSS1062: Expected semicolon or closing curly-brace, found ':'
(1680,1): run-time error CSS1019: Unexpected token, found '@keyframes'
(1682,5): run-time error CSS1062: Expected semicolon or closing curly-brace, found '50%'
(1685,1): run-time error CSS1019: Unexpected token, found '@-webkit-keyframes'
(1687,5): run-time error CSS1062: Expected semicolon or …Run Code Online (Sandbox Code Playgroud) 我试图只计算组HourTarget总数.
7:00 8:00 HourTarget
Line 1 2715 1008 3224
A 2307 1008 3224
B 408 0 3224
Line 2 2308 2432 2656
A 2308 2432 2656
Line 3 2318 1622 2800
A 345 1258 2800
B 762 0 2800
C 1211 364 2800
Run Code Online (Sandbox Code Playgroud)
由于HourTarget的总和,我试图达到8680.但是我得到17504.这是因为数据库表中的HourTarget是该行上运行的每个产品的记录,但目标与行而不是产品有关.我如何只计算集团总数?
像这样的东西不起作用:
=Sum(Max(Fields!HourTarget.Value))
Run Code Online (Sandbox Code Playgroud) 我正在使用SQL Server 2014,并希望利用新功能CHOOSE和RAND.基本上想从列表中返回随机颜色.
就像是:
Select CHOOSE(RAND(29), 'bg-blue', 'bg-blue-madison', 'bg-blue-hoki', 'bg-blue-steel', 'bg-blue-chambray',
'bg-green-meadow', 'bg-green', 'bg-green-seagreen', 'bg-green-turquoise', 'bg-green-haze', 'bg-green-jungle',
'bg-red', 'bg-red-pink', 'bg-red-sunglo', 'bg-red-intense', 'bg-red-thunderbird', 'bg-red-flamingo',
'bg-yellow', 'bg-yellow-gold', 'bg-yellow-casablanca', 'bg-yellow-lemon',
'bg-purple', 'bg-purple-plum', 'bg-purple-studio', 'bg-purple-seance',
'bg-grey-cascade', 'bg-grey-silver', 'bg-grey-steel', 'bg-grey-gallery') AS Colour
Run Code Online (Sandbox Code Playgroud)
可能吗?
我正在尝试使用新的Entity Framework Core存储过程.我需要很快启动新项目,这将是ASP.Net 5,但不确定实体框架是否适合这项工作.应用程序将每分钟触发几个存储过程,我需要输出参数.EF会对此有好处还是我应该使用ADO.Net?
我试过FromSql和database.ExecuteSqlCommand但没有运气.
using (AppDbContext db = factory.Create())
{
var in1 = new SqlParameter
{
ParameterName = "ParamIn1",
DbType = System.Data.DbType.Int64,
Direction = System.Data.ParameterDirection.Input
};
var in2 = new SqlParameter
{
ParameterName = "ParamIn2",
DbType = System.Data.DbType.String,
Direction = System.Data.ParameterDirection.Input
};
var out1 = new SqlParameter
{
ParameterName = "ParamOut1",
DbType = System.Data.DbType.Int64,
Direction = System.Data.ParameterDirection.Output
};
var out2 = new SqlParameter
{
ParameterName = "ParamOut2",
DbType = System.Data.DbType.String,
Direction = System.Data.ParameterDirection.Output
};
var result = db.Database.ExecuteSqlCommand("exec spTestSp", …Run Code Online (Sandbox Code Playgroud) 在之前的版本中,我会像这里一样.但是在新版本的ASP中没有web.config文件,我相信它应该在launchSettings.json文件中完成.
基本上我想做的就是停止缓存app.js文件和模板文件夹中的所有.html文件.我该怎么做?
我正在使用ui-router进行状态处理.这工作正常,但现在我必须创建页面404,并希望在整个页面上显示它,而不是像其他页面一样在页面内显示.
app.config(['$stateProvider', '$urlRouterProvider', '$locationProvider',
function ($stateProvider, $urlRouterProvider, $locationProvider) {
$locationProvider.hashPrefix('!').html5Mode({
enabled: true,
requireBase: false
});
$stateProvider
.state('stateIndex', {
url: '/',
templateUrl: '/templates/list.html',
controller: 'dashListController'
})
.state('stateList', {
url: '/list',
templateUrl: '/templates/list.html',
controller: 'dashListController'
}).state('stateDashboard', {
url: '/dashboard/:id',
templateUrl: '/templates/dashboard.html',
controller: 'dashboardController'
})
.state('stateWidgetsList', {
url: '/widgetsList',
templateUrl: '/templates/widgetsList.html',
controller: 'widgetsListController'
})
.state('404', {
url: '/404',
templateUrl: '/templates/404.html'
});
}]);
Run Code Online (Sandbox Code Playgroud)
在我的index.html上我有
<div ui-view></div>
Run Code Online (Sandbox Code Playgroud)
在我显示所有页面的地方,除此之外我还有徽标,菜单等.我想在显示404页面时隐藏它.
我该怎么做?
如何将 C# 字典正确传递到 typescript Map 中。
[HttpGet("reportsUsage")]
public IActionResult GetReportsUsage()
{
//var reportsUsage = _statService.GetReportsUsage();
IDictionary<int, int> test = new Dictionary<int, int>();
test.Add(1, 20);
test.Add(2, 30);
test.Add(3, 40);
test.Add(4, 50);
test.Add(5, 70);
test.Add(6, 60);
test.Add(7, 90);
test.Add(8, 30);
return Ok(test);
//return Ok(reportsUsage );
}
Run Code Online (Sandbox Code Playgroud)
以角度表示:
getReportsUsage() {
return this.http.get<Map<number, number>>(`${environment.apiUrl}/stats/reportsUsage`, {
headers: new HttpHeaders({
'Content-Type': 'text/plain',
'Accept': 'application/json'
}),
withCredentials: true
});
}
reportsUsage = new Map<number, number>();
this.statsService.getReportsUsage().subscribe(data => {
this.reportsUsage = data;
//1
console.log(this.reportsUsage);
//2
console.log(this.reportsUsage.values());
//3
console.log(typeof(this.reportsUsage)); …Run Code Online (Sandbox Code Playgroud) 我的应用程序中有一个列表框,可以很好地工作.但要进行多项选择,我需要按ctrl并单击该项目.如何更改此行为,因此每次单击列表中的项目时,它都会选择它,再次按下时它会取消选择,但只会选择其中一个选定的项目.
我的列表框:
@Html.ListBoxFor(m => m.selectedCharts, new SelectList(@Model.Graphs.ToList() )
, new { @class = "select_change" }
)
Run Code Online (Sandbox Code Playgroud)
或者也许我应该为此目的使用不同的控制?
非常感谢
我正在寻找一种方式来传递DataTable的,以PartialView使用Controller操作.或者如果你知道更好的方式,我愿意接受建议.
控制器:
public DataTable GetDailyOutput()
{
Graph g = repository.Graphs.Where(p => p.GraphID == 2).FirstOrDefault();
DataTable dt = repository.GetGraphData(g.StoredProc);
return dt;
}
Run Code Online (Sandbox Code Playgroud)
视图:
<div id="dvCategoryResults">
@{Html.Partial("_GetDailyOutput", Html.Action("GetDailyOutput", "Graph"));}
</div>
Run Code Online (Sandbox Code Playgroud)
局部视图:
@model System.Data.DataTable
@using System.Data
<table>
<thead>
<tr>
@foreach (DataColumn col in Model.Columns)
{
<th>
@col.ColumnName
</th>
}
</tr>
</thead>
<tbody>
@foreach (DataRow row in Model.Rows)
{
<tr>
@foreach (DataColumn col in Model.Columns)
{
<td>
@row[col.ColumnName]
</td>
}
</tr>
}
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
我的下一步是使用Ajax调用更新表并刷新PartialView.
想为按钮添加样式,并且不明白为什么我必须包括以下代码行,而我不想在按钮上添加任何边框:
<Border Background="{TemplateBinding Background}">
Run Code Online (Sandbox Code Playgroud)
完整的代码:
<Style x:Key="ButtonStyleRed" TargetType="{x:Type Button}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}">
<StackPanel Orientation="Horizontal" Width="200">
<Rectangle Width="4" Height="30" Fill="#64dd17" Margin="0,0,10,1" RadiusX="2" RadiusY="2"/>
<TextBlock Text="{Binding Path=DataContext.FlowStageName,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}}"
VerticalAlignment="Center" FontSize="14" Foreground="White" TextWrapping="WrapWithOverflow"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsFocused" Value="True"/>
<Trigger Property="IsDefaulted" Value="True"/>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#263238"></Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True"/>
<Trigger Property="IsEnabled" Value="False"/>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"></Setter>
<Setter Property="Width" Value="200"/>
<Setter Property="Height" …Run Code Online (Sandbox Code Playgroud) 我正在尝试将Datatable列转换为Series数组(我稍后将其用于将它们序列化为Json),但不确定如何将字符串数组转换为IList?或许我应该使用其他方法?但不确定如何将字符串数组转换为IList<SeriesValue>?或许我应该使用其他方法?
public Series[] GetGraphData(string sp)
{
var connection = ConfigurationManager.ConnectionStrings["EFDbContext"].ConnectionString;
using (var da = new SqlDataAdapter("exec " + sp, connection))
{
var dt = new DataTable();
da.Fill(dt);
da.FillSchema(dt, SchemaType.Mapped);
Series[] arrSeries = new Series[dt.Columns.Count];
foreach(DataColumn dc in dt.Columns)
{
if (dc.Ordinal == 0)
{
}
else
{
Series s = new Series()
{
seriesname = dc.ColumnName,
renderas = "Line",
data = dt.Rows.Cast<DataRow>().Select(row => row[dc.Ordinal]).Cast<SeriesValue>().ToList()
};
arrSeries[dc.Ordinal] = s;
}
}
return arrSeries;
}
}
public class Series
{ …Run Code Online (Sandbox Code Playgroud) 是否可以简化此操作并仅在一行中使用它,而无需if (strFilter == ""):
if (strFilter == "")
{
IList<User> users = Context.Users.Where(u => u.Location == "UK").ToList();
}
else
{
IList<User> users = Context.Users.Where(u => u.Location == "UK" && u.JobTitle == strFilter).ToList();
}
Run Code Online (Sandbox Code Playgroud) asp.net ×3
asp.net-mvc ×3
asp.net-core ×2
c# ×2
angular ×1
angularjs ×1
caching ×1
iis ×1
javascript ×1
lambda ×1
linq ×1
razor ×1
sql-server ×1
ssrs-2008 ×1
typescript ×1
wpf ×1
xaml ×1